Completed
Branch BUG-7537 (396ea7)
by
unknown
310:09 queued 289:41
created
admin_pages/venues/Venues_Admin_Page_Init.core.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -32,13 +32,13 @@  discard block
 block discarded – undo
32 32
 
33 33
 	public function __construct() {
34 34
 		//define some event categories related constants
35
-		define( 'EE_VENUES_PG_SLUG', 'espresso_venues' );
36
-		define( 'EE_VENUES_ADMIN_URL', admin_url('admin.php?page=' . EE_VENUES_PG_SLUG ));
37
-		define( 'EE_VENUES_ASSETS_URL', EE_ADMIN_PAGES_URL . 'venues/assets/');
38
-		define( 'EE_VENUES_TEMPLATE_PATH', EE_ADMIN_PAGES . 'venues/templates/' );
35
+		define('EE_VENUES_PG_SLUG', 'espresso_venues');
36
+		define('EE_VENUES_ADMIN_URL', admin_url('admin.php?page='.EE_VENUES_PG_SLUG));
37
+		define('EE_VENUES_ASSETS_URL', EE_ADMIN_PAGES_URL.'venues/assets/');
38
+		define('EE_VENUES_TEMPLATE_PATH', EE_ADMIN_PAGES.'venues/templates/');
39 39
 
40 40
 		parent::__construct();
41
-		$this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . DS;
41
+		$this->_folder_path = EE_ADMIN_PAGES.$this->_folder_name.DS;
42 42
 	}
43 43
 
44 44
 	protected function _set_init_properties() {
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
 
51 51
 	protected function _set_menu_map() {
52
-		$this->_menu_map = new EE_Admin_Page_Sub_Menu( array(
52
+		$this->_menu_map = new EE_Admin_Page_Sub_Menu(array(
53 53
 			'menu_group' => 'management',
54 54
 			'menu_order' => 40,
55 55
 			'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY,
Please login to merge, or discard this patch.
admin_pages/venues/espresso_events_Venues_Hooks.class.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -33,8 +33,8 @@  discard block
 block discarded – undo
33 33
 	protected $_event;
34 34
 
35 35
 
36
-	public function __construct( EE_Admin_Page $admin_page ) {
37
-		parent::__construct( $admin_page );
36
+	public function __construct(EE_Admin_Page $admin_page) {
37
+		parent::__construct($admin_page);
38 38
 	}
39 39
 
40 40
 
@@ -49,18 +49,18 @@  discard block
 block discarded – undo
49 49
 				'priority' => 'high',
50 50
 				'context' => 'normal'
51 51
 				)
52
-		);/**/
52
+		); /**/
53 53
 
54 54
 		$this->_scripts_styles = array(
55 55
 			'registers' => array(
56 56
 				'ee_event_venues' => array(
57 57
 					'type' => 'js',
58
-					'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.js',
58
+					'url' => EE_VENUES_ASSETS_URL.'ee-event-venues-admin.js',
59 59
 					'depends' => array('jquery')
60 60
 					),
61 61
 				'ee_event_venues_css' => array(
62 62
 					'type' => 'css',
63
-					'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.css',
63
+					'url' => EE_VENUES_ASSETS_URL.'ee-event-venues-admin.css',
64 64
 					)
65 65
 				),
66 66
 			'enqueues' => array(
@@ -70,24 +70,24 @@  discard block
 block discarded – undo
70 70
 			);
71 71
 
72 72
 		//hook into the handler for saving venue
73
-		add_filter( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'modify_callbacks' ), 10 );
73
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'modify_callbacks'), 10);
74 74
 
75 75
 		//remove default ee_autosave returns for DECAF venues (not needed for CAF venues cause we have a dropdown selector)
76
-		add_filter( 'FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', '__return_false' );
76
+		add_filter('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', '__return_false');
77 77
 
78 78
 	}
79 79
 
80 80
 
81
-	public function modify_callbacks( $callbacks ) {
81
+	public function modify_callbacks($callbacks) {
82 82
 		// first remove default venue callback
83
-		foreach ( $callbacks as $key => $callback ) {
84
-			if ( $callback[1] == '_default_venue_update' ) {
85
-				unset( $callbacks[$key] );
83
+		foreach ($callbacks as $key => $callback) {
84
+			if ($callback[1] == '_default_venue_update') {
85
+				unset($callbacks[$key]);
86 86
 			}
87 87
 		}
88 88
 
89 89
 		//now let's add the caf version
90
-		$callbacks[] = array( $this, 'caf_venue_update' );
90
+		$callbacks[] = array($this, 'caf_venue_update');
91 91
 		return $callbacks;
92 92
 	}
93 93
 
@@ -103,69 +103,69 @@  discard block
 block discarded – undo
103 103
 		$evt_id = $evt_obj->ID();
104 104
 
105 105
 		//first let's see if we have a venue already
106
-		$evt_venues = !empty( $evt_id ) ? $evt_obj->venues() : array();
107
-		$evt_venue = $evt_venues && is_array( $evt_venues ) ? reset( $evt_venues ) : null;
106
+		$evt_venues = ! empty($evt_id) ? $evt_obj->venues() : array();
107
+		$evt_venue = $evt_venues && is_array($evt_venues) ? reset($evt_venues) : null;
108 108
 		$evt_venue_id = $evt_venue instanceof EE_Venue ? $evt_venue->ID() : null;
109 109
 
110 110
 		//possibly private venues.
111
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) {
112
-			$vnu_where['status']= array( 'IN' , array( 'publish', 'private' ) );
111
+		if (EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) {
112
+			$vnu_where['status'] = array('IN', array('publish', 'private'));
113 113
 		} else {
114 114
 			$vnu_where['status'] = 'publish';
115 115
 		}
116 116
 
117 117
 		//cap checks
118
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) {
118
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) {
119 119
 			$vnu_where['VNU_wp_user'] = get_current_user_id();
120 120
 		}
121 121
 
122
-		$vnumdl = EE_Registry::instance()->load_model( 'Venue' );
123
-		$venues = $vnumdl->get_all( array( $vnu_where, 'order_by' => array( 'VNU_name' => 'ASC' ) ) );
122
+		$vnumdl = EE_Registry::instance()->load_model('Venue');
123
+		$venues = $vnumdl->get_all(array($vnu_where, 'order_by' => array('VNU_name' => 'ASC')));
124 124
 
125 125
 		$ven_select = array();
126 126
 		$ven_select[0] = __('Select a Venue', 'event_espresso');
127 127
 		//setup venues for selector
128
-		foreach ( $venues as $venue ) {
128
+		foreach ($venues as $venue) {
129 129
 			$ven_select[$venue->ID()] = $venue->name();
130 130
 		}
131 131
 
132 132
 		//if $ven_select does not have the existing venue attached to event then let's add that because we'll always
133 133
 		//show existing attached venues even if it's trashed (or some other restricted status).
134 134
 
135
-		if ( $evt_venue_id && ! isset( $ven_select[$evt_venue_id] ) ) {
135
+		if ($evt_venue_id && ! isset($ven_select[$evt_venue_id])) {
136 136
 			$ven_select[$evt_venue_id] = $evt_venue->name();
137
-			$venues = array_merge( $venues, array( $evt_venue ) );
137
+			$venues = array_merge($venues, array($evt_venue));
138 138
 		}
139 139
 
140 140
 		$template_args['venues'] = $venues;
141 141
 		$template_args['evt_venue_id'] = $evt_venue_id;
142
-		$template_args['venue_selector'] = EEH_Form_Fields::select_input('venue_id', $ven_select, $evt_venue_id, 'id="venue_id"' );
143
-		$template_args['enable_for_gmap'] = EEH_Form_Fields::select_input('enable_for_gmap', $values, is_object( $evt_venue ) ? $evt_venue->enable_for_gmap() : NULL, 'id="enable_for_gmap"');
144
-		$template_path = empty( $venues ) ? EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content.template.php' : EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content_from_manager.template.php';
145
-		EEH_Template::display_template( $template_path, $template_args );
142
+		$template_args['venue_selector'] = EEH_Form_Fields::select_input('venue_id', $ven_select, $evt_venue_id, 'id="venue_id"');
143
+		$template_args['enable_for_gmap'] = EEH_Form_Fields::select_input('enable_for_gmap', $values, is_object($evt_venue) ? $evt_venue->enable_for_gmap() : NULL, 'id="enable_for_gmap"');
144
+		$template_path = empty($venues) ? EE_VENUES_TEMPLATE_PATH.'event_venues_metabox_content.template.php' : EE_VENUES_TEMPLATE_PATH.'event_venues_metabox_content_from_manager.template.php';
145
+		EEH_Template::display_template($template_path, $template_args);
146 146
 	}
147 147
 
148 148
 
149 149
 
150 150
 
151
-	public function caf_venue_update( $evtobj, $data ) {
151
+	public function caf_venue_update($evtobj, $data) {
152 152
 		EE_Registry::instance()->load_model('Venue');
153
-		$venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL;
153
+		$venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL;
154 154
 
155 155
 
156 156
 		//first let's check if the selected venue matches any existing venue attached to the event
157 157
 		$evt_venue = $evtobj->venues();
158
-		$evt_venue = !empty( $evt_venue ) ? array_shift( $evt_venue ) : NULL;
158
+		$evt_venue = ! empty($evt_venue) ? array_shift($evt_venue) : NULL;
159 159
 
160
-		if ( !empty( $evt_venue ) && $evt_venue->ID() != $venue_id )
161
-			$evtobj->_remove_relation_to( $evt_venue->ID(), 'Venue' );
160
+		if ( ! empty($evt_venue) && $evt_venue->ID() != $venue_id)
161
+			$evtobj->_remove_relation_to($evt_venue->ID(), 'Venue');
162 162
 
163
-		if ( empty( $venue_id ) )
163
+		if (empty($venue_id))
164 164
 			return TRUE; //no venue to attach
165 165
 
166 166
 		// this should take care of adding to revisions as well as main post object
167
-		$success = $evtobj->_add_relation_to( $venue_id, 'Venue' );
168
-		return !empty($success) ? TRUE : FALSE;
167
+		$success = $evtobj->_add_relation_to($venue_id, 'Venue');
168
+		return ! empty($success) ? TRUE : FALSE;
169 169
 	}
170 170
 
171 171
 
Please login to merge, or discard this patch.
admin/extend/messages/espresso_events_Messages_Hooks_Extend.class.php 1 patch
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -30,15 +30,15 @@  discard block
 block discarded – undo
30 30
 class espresso_events_Messages_Hooks_Extend extends espresso_events_Messages_Hooks {
31 31
 
32 32
 
33
-	public function __construct( EE_Admin_Page $adminpage ) {
33
+	public function __construct(EE_Admin_Page $adminpage) {
34 34
 		/**
35 35
 		 * Add cap restriction ... metaboxes should not show if user does not have the ability to edit_custom_messages
36 36
 		 */
37
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'messages_events_editor_metabox' ) ) {
37
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'messages_events_editor_metabox')) {
38 38
 			return;
39 39
 		}
40
-		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'caf_updates' ), 10 );
41
-		parent::__construct( $adminpage );
40
+		add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'caf_updates'), 10);
41
+		parent::__construct($adminpage);
42 42
 	}
43 43
 
44 44
 	/**
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 	 */
50 50
 	protected function _extend_properties() {
51 51
 
52
-		define( 'EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'messages/assets/' );
52
+		define('EE_MSGS_EXTEND_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'messages/assets/');
53 53
 		$this->_ajax_func = array(
54 54
 			'ee_msgs_create_new_custom' => 'create_new_custom'
55 55
 			);
56 56
 		$this->_metaboxes = array(
57 57
 			0 => array(
58
-				'page_route' => array('edit','create_new'),
58
+				'page_route' => array('edit', 'create_new'),
59 59
 				'func' => 'messages_metabox',
60 60
 				'label' => __('Notifications', 'event_espresso'),
61 61
 				'priority' => 'high'
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 		$this->_scripts_styles = array(
67 67
 			'registers' => array(
68 68
 				'events_msg_admin' => array(
69
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'events_messages_admin.js',
69
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'events_messages_admin.js',
70 70
 					'depends' => array('ee-dialog', 'ee-parse-uri', 'ee-serialize-full-array')
71 71
 					),
72 72
 				'events_msg_admin_css' => array(
73
-					'url' => EE_MSGS_EXTEND_ASSETS_URL . 'ee_msg_events_admin.css',
73
+					'url' => EE_MSGS_EXTEND_ASSETS_URL.'ee_msg_events_admin.css',
74 74
 					'type' => 'css'
75 75
 					)
76 76
 				),
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
 	}
83 83
 
84 84
 
85
-	public function caf_updates( $update_callbacks ) {
86
-		$update_callbacks[] = array( $this, 'attach_evt_message_templates' );
85
+	public function caf_updates($update_callbacks) {
86
+		$update_callbacks[] = array($this, 'attach_evt_message_templates');
87 87
 		return $update_callbacks;
88 88
 	}
89 89
 
@@ -96,13 +96,13 @@  discard block
 block discarded – undo
96 96
 	 * @param  array       $data   The request data from the form
97 97
 	 * @return bool         success or fail
98 98
 	 */
99
-	public function attach_evt_message_templates( $evtobj, $data ) {
99
+	public function attach_evt_message_templates($evtobj, $data) {
100 100
 		//first we remove all existing relations on the Event for message types.
101 101
 		$evtobj->_remove_relations('Message_Template_Group');
102 102
 
103 103
 		//now let's just loop throught the selected templates and add relations!
104
-		foreach( $data['event_message_templates_relation'] as $grp_ID ) {
105
-			$evtobj->_add_relation_to( $grp_ID, 'Message_Template_Group' );
104
+		foreach ($data['event_message_templates_relation'] as $grp_ID) {
105
+			$evtobj->_add_relation_to($grp_ID, 'Message_Template_Group');
106 106
 		}
107 107
 
108 108
 		//now save
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 
116 116
 		//let's get the active messengers (b/c messenger objects have the active message templates)
117 117
 		//convert 'evt_id' to 'EVT_ID'
118
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['EVT_ID'] ) ? $this->_req_data['EVT_ID'] : NULL;
119
-		$this->_req_data['EVT_ID'] = isset( $this->_req_data['post'] ) && empty( $this->_req_data['EVT_ID'] ) ? $this->_req_data['post'] : $this->_req_data['EVT_ID'];
118
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
119
+		$this->_req_data['EVT_ID'] = isset($this->_req_data['post']) && empty($this->_req_data['EVT_ID']) ? $this->_req_data['post'] : $this->_req_data['EVT_ID'];
120 120
 
121
-		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID'] ) && isset($this->_req_data['evt_id'] ) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID'];
121
+		$this->_req_data['EVT_ID'] = empty($this->_req_data['EVT_ID']) && isset($this->_req_data['evt_id']) ? $this->_req_data['evt_id'] : $this->_req_data['EVT_ID'];
122 122
 
123 123
 
124 124
 		$EEM_controller = new EE_messages;
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
 
128 128
 		//empty messengers?
129 129
 		//Note message types will always have at least one available because every messenger has a default message type associated with it (payment) if no other message types are selected.
130
-		if ( empty( $active_messengers ) ) {
131
-			$msg_activate_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'settings'), EE_MSG_ADMIN_URL );
132
-			$error_msg = sprintf( __('There are no active messengers. So no notifications will go out for <strong>any</strong> events.  You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="' . $msg_activate_url . '">', '</a>');
133
-			$error_content = '<div class="error"><p>' . $error_msg . '</p></div>';
134
-			$internal_content = '<div id="messages-error"><p>' . $error_msg . '</p></div>';
130
+		if (empty($active_messengers)) {
131
+			$msg_activate_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'settings'), EE_MSG_ADMIN_URL);
132
+			$error_msg = sprintf(__('There are no active messengers. So no notifications will go out for <strong>any</strong> events.  You will want to %sActivate a Messenger%s.', 'event_espresso'), '<a href="'.$msg_activate_url.'">', '</a>');
133
+			$error_content = '<div class="error"><p>'.$error_msg.'</p></div>';
134
+			$internal_content = '<div id="messages-error"><p>'.$error_msg.'</p></div>';
135 135
 
136 136
 			echo $error_content;
137 137
 			echo $internal_content;
@@ -140,39 +140,39 @@  discard block
 block discarded – undo
140 140
 
141 141
 		$event_id = isset($this->_req_data['EVT_ID']) ? $this->_req_data['EVT_ID'] : NULL;
142 142
 		//get content for active messengers
143
-		foreach ( $active_messengers as $name => $messenger ) {
143
+		foreach ($active_messengers as $name => $messenger) {
144 144
 			//first check if there are any active message types for this messenger.
145
-			$active_mts = $EEM_controller->get_active_message_types_per_messenger( $name );
146
-			if ( empty( $active_mts ) ) {
145
+			$active_mts = $EEM_controller->get_active_message_types_per_messenger($name);
146
+			if (empty($active_mts)) {
147 147
 				continue;
148 148
 			}
149 149
 
150
-			$tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id) );
150
+			$tcont = $messenger->get_messenger_admin_page_content('events', 'edit', array('event' => $event_id));
151 151
 
152
-			if ( ! empty( $tcont ) ) {
152
+			if ( ! empty($tcont)) {
153 153
 				$tabs[$name] = $tcont;
154 154
 			}
155 155
 		}
156 156
 
157 157
 
158
-		EE_Registry::instance()->load_helper( 'Tabbed_Content' );
158
+		EE_Registry::instance()->load_helper('Tabbed_Content');
159 159
 		//we want this to be tabbed content so let's use the EEH_Tabbed_Content::display helper.
160 160
 		$tabbed_content = EEH_Tabbed_Content::display($tabs);
161
-		if ( is_wp_error($tabbed_content) ) {
161
+		if (is_wp_error($tabbed_content)) {
162 162
 			$tabbed_content = $tabbed_content->get_error_message();
163 163
 		}
164 164
 
165 165
 		$notices = '<div id="espresso-ajax-loading" class="ajax-loader-grey">
166
-				<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso') . '</span>
166
+				<span class="ee-spinner ee-spin"></span><span class="hidden">' . __('loading...', 'event_espresso').'</span>
167 167
 			</div><div class="ee-notices"></div>';
168 168
 
169
-		if ( defined('DOING_AJAX' ) ) {
169
+		if (defined('DOING_AJAX')) {
170 170
 			return $tabbed_content;
171 171
 		}
172 172
 
173
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content' );
174
-		echo $notices . '<div class="messages-tabs-content">' . $tabbed_content . '</div>';
175
-		do_action( 'AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content' );
173
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__before_content');
174
+		echo $notices.'<div class="messages-tabs-content">'.$tabbed_content.'</div>';
175
+		do_action('AHEE__espresso_events_Messages_Hooks_Extend__messages_metabox__after_content');
176 176
 
177 177
 	}
178 178
 
@@ -186,22 +186,22 @@  discard block
 block discarded – undo
186 186
 	 */
187 187
 	public function create_new_custom() {
188 188
 
189
-		if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_edit_messages', 'create_new_custom_ajax' ) ) {
190
-			wp_die( __('You don\'t have privileges to do this action', 'event_espresso' ) );
189
+		if ( ! EE_Registry::instance()->CAP->current_user_can('ee_edit_messages', 'create_new_custom_ajax')) {
190
+			wp_die(__('You don\'t have privileges to do this action', 'event_espresso'));
191 191
 		}
192 192
 
193 193
 		//let's clean up the _POST global a bit for downstream usage of name and description.
194
-		$_POST['templateName'] = !empty( $this->_req_data['custom_template_args']['MTP_name'] ) ? $this->_req_data['custom_template_args']['MTP_name'] : '';
195
-		$_POST['templateDescription'] = !empty( $this->_req_data['custom_template_args']['MTP_description'] ) ? $this->_req_data['custom_template_args']['MTP_description'] : '';
194
+		$_POST['templateName'] = ! empty($this->_req_data['custom_template_args']['MTP_name']) ? $this->_req_data['custom_template_args']['MTP_name'] : '';
195
+		$_POST['templateDescription'] = ! empty($this->_req_data['custom_template_args']['MTP_description']) ? $this->_req_data['custom_template_args']['MTP_description'] : '';
196 196
 
197 197
 
198 198
 		//set EE_Admin_Page object (see method details in EE_Admin_Hooks parent
199 199
 		$this->_set_page_object();
200 200
 
201 201
 		//is this a template switch if so EE_Admin_Page child needs this object
202
-		$this->_page_object->set_hook_object( $this );
202
+		$this->_page_object->set_hook_object($this);
203 203
 
204
-		$this->_page_object->add_message_template( $this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID'] );
204
+		$this->_page_object->add_message_template($this->_req_data['messageType'], $this->_req_data['messenger'], $this->_req_data['group_ID']);
205 205
 	}
206 206
 
207 207
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * @return string (admin_footer contents)
217 217
 	 */
218 218
 	public function edit_admin_footer() {
219
-		$template_path = EE_CORE_CAF_ADMIN_EXTEND . 'messages/templates/create_custom_template_form.template.php';
219
+		$template_path = EE_CORE_CAF_ADMIN_EXTEND.'messages/templates/create_custom_template_form.template.php';
220 220
 		EEH_Template::display_template($template_path, array());
221 221
 	}
222 222
 
Please login to merge, or discard this patch.
admin/extend/registration_form/Extend_Registration_Form_Admin_Page.core.php 1 patch
Spacing   +154 added lines, -154 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -30,13 +30,13 @@  discard block
 block discarded – undo
30 30
 
31 31
 
32 32
 
33
-	public function __construct( $routing = TRUE ) {
34
-		define( 'REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND . 'registration_form' . DS );
35
-		define( 'REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN . 'assets' . DS );
36
-		define( 'REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/assets/' );
37
-		define( 'REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN . 'templates' . DS );
38
-		define( 'REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/templates/' );
39
-		parent::__construct( $routing );
33
+	public function __construct($routing = TRUE) {
34
+		define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND.'registration_form'.DS);
35
+		define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN.'assets'.DS);
36
+		define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/assets/');
37
+		define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN.'templates'.DS);
38
+		define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/templates/');
39
+		parent::__construct($routing);
40 40
 	}
41 41
 
42 42
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 
47 47
 	protected function _extend_page_config() {
48 48
 		$this->_admin_base_path = REGISTRATION_FORM_CAF_ADMIN;
49
-		$qst_id = ! empty( $this->_req_data['QST_ID'] ) && ! is_array( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0;
50
-		$qsg_id = ! empty( $this->_req_data['QSG_ID'] ) && ! is_array( $this->_req_data['QSG_ID'] ) ? $this->_req_data['QSG_ID'] : 0;
49
+		$qst_id = ! empty($this->_req_data['QST_ID']) && ! is_array($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0;
50
+		$qsg_id = ! empty($this->_req_data['QSG_ID']) && ! is_array($this->_req_data['QSG_ID']) ? $this->_req_data['QSG_ID'] : 0;
51 51
 
52 52
 		$new_page_routes = array(
53 53
 			'question_groups' => array(
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 				'func' => '_trash_or_restore_questions',
81 81
 				'capability' => 'ee_delete_question',
82 82
 				'obj_id' => $qst_id,
83
-				'args' => array( 'trash' => FALSE ),
83
+				'args' => array('trash' => FALSE),
84 84
 				'noheader' => TRUE
85 85
 				),
86 86
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
 			'trash_question_group' => array(
141 141
 				'func' => '_trash_or_restore_question_groups',
142
-				'args' => array( 'trash' => TRUE ),
142
+				'args' => array('trash' => TRUE),
143 143
 				'capability' => 'ee_delete_question_group',
144 144
 				'obj_id' => $qsg_id,
145 145
 				'noheader' => TRUE
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
 			'restore_question_group' => array(
149 149
 				'func' => '_trash_or_restore_question_groups',
150
-				'args' => array( 'trash' => FALSE ),
150
+				'args' => array('trash' => FALSE),
151 151
 				'capability' => 'ee_delete_question_group',
152 152
 				'obj_id' => $qsg_id,
153 153
 				'noheader' => TRUE
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 
163 163
 			'update_question_group' => array(
164 164
 				'func' => '_insert_or_update_question_group',
165
-				'args' => array('new_question_group' => FALSE ),
165
+				'args' => array('new_question_group' => FALSE),
166 166
 				'capability' => 'ee_edit_question_group',
167 167
 				'obj_id' => $qsg_id,
168 168
 				'noheader' => TRUE,
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 					'noheader' => TRUE
201 201
 				),
202 202
 			);
203
-		$this->_page_routes = array_merge( $this->_page_routes, $new_page_routes );
203
+		$this->_page_routes = array_merge($this->_page_routes, $new_page_routes);
204 204
 
205 205
 		$new_page_config = array(
206 206
 
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 						'filename' => 'registration_form_question_groups_views_bulk_actions_search'
225 225
 						),
226 226
 					),
227
-				'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'),
227
+				'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'),
228 228
 				'metaboxes' => $this->_default_espresso_metaboxes,
229 229
 				'require_nonce' => FALSE,
230 230
 				'qtips' => array(
@@ -238,14 +238,14 @@  discard block
 block discarded – undo
238 238
 					'order' => 5,
239 239
 					'persistent' => FALSE
240 240
 					),
241
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
241
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
242 242
                 'help_tabs' => array(
243 243
 					'registration_form_add_question_help_tab' => array(
244 244
 						'title' => __('Add Question', 'event_espresso'),
245 245
 						'filename' => 'registration_form_add_question'
246 246
 						),
247 247
 					),
248
-                'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'),
248
+                'help_tour' => array('Registration_Form_Add_Question_Help_Tour'),
249 249
 				'require_nonce' => FALSE
250 250
 				),
251 251
 
@@ -255,14 +255,14 @@  discard block
 block discarded – undo
255 255
 					'order' => 5,
256 256
 					'persistent' => FALSE
257 257
 					),
258
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
258
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
259 259
 				'help_tabs' => array(
260 260
 					'registration_form_add_question_group_help_tab' => array(
261 261
 						'title' => __('Add Question Group', 'event_espresso'),
262 262
 						'filename' => 'registration_form_add_question_group'
263 263
 						),
264 264
 					),
265
-                'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'),
265
+                'help_tour' => array('Registration_Form_Add_Question_Group_Help_Tour'),
266 266
 				'require_nonce' => FALSE
267 267
 				),
268 268
 
@@ -271,16 +271,16 @@  discard block
 block discarded – undo
271 271
 					'label' => __('Edit Question Group', 'event_espresso'),
272 272
 					'order' => 5,
273 273
 					'persistent' => FALSE,
274
-					'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id'] ), $this->_current_page_view_url )  : $this->_admin_base_url
274
+					'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id']), $this->_current_page_view_url) : $this->_admin_base_url
275 275
 					),
276
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ),
276
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
277 277
 				'help_tabs' => array(
278 278
 					'registration_form_edit_question_group_help_tab' => array(
279 279
 						'title' => __('Edit Question Group', 'event_espresso'),
280 280
 						'filename' => 'registration_form_edit_question_group'
281 281
 						),
282 282
 					),
283
-                'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'),
283
+                'help_tour' => array('Registration_Form_Edit_Question_Group_Help_Tour'),
284 284
 				'require_nonce' => FALSE
285 285
 				),
286 286
 
@@ -292,19 +292,19 @@  discard block
 block discarded – undo
292 292
 				'labels' => array(
293 293
 					'publishbox' => __('Update Settings', 'event_espresso')
294 294
 					),
295
-				'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ),
295
+				'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')),
296 296
 				'help_tabs' => array(
297 297
 					'registration_form_reg_form_settings_help_tab' => array(
298 298
 						'title' => __('Registration Form Settings', 'event_espresso'),
299 299
 						'filename' => 'registration_form_reg_form_settings'
300 300
 						),
301 301
 					),
302
-                'help_tour' => array( 'Registration_Form_Settings_Help_Tour'),
302
+                'help_tour' => array('Registration_Form_Settings_Help_Tour'),
303 303
 				'require_nonce' => FALSE
304 304
 				)
305 305
 
306 306
 			);
307
-		$this->_page_config = array_merge( $this->_page_config, $new_page_config );
307
+		$this->_page_config = array_merge($this->_page_config, $new_page_config);
308 308
 
309 309
 		//change the list table we're going to use so it's the NEW list table!
310 310
 		$this->_page_config['default']['list_table'] = 'Extend_Registration_Form_Questions_Admin_List_Table';
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 			'edit_question_group' => __('Edit Question Group', 'event_espresso'),
319 319
 			'delete_question_group' => __('Delete Question Group', 'event_espresso'),
320 320
 			);
321
-		$this->_labels['buttons'] = array_merge( $this->_labels['buttons'], $new_labels );
321
+		$this->_labels['buttons'] = array_merge($this->_labels['buttons'], $new_labels);
322 322
 
323 323
 	}
324 324
 
@@ -327,14 +327,14 @@  discard block
 block discarded – undo
327 327
 
328 328
 
329 329
 	protected function _ajax_hooks() {
330
-		add_action('wp_ajax_espresso_update_question_group_order', array( $this, 'update_question_group_order' ));
330
+		add_action('wp_ajax_espresso_update_question_group_order', array($this, 'update_question_group_order'));
331 331
 	}
332 332
 
333 333
 
334 334
 
335 335
 
336 336
 	public function load_scripts_styles_question_groups() {
337
-		wp_enqueue_script( 'espresso_ajax_table_sorting' );
337
+		wp_enqueue_script('espresso_ajax_table_sorting');
338 338
 	}
339 339
 
340 340
 
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 * @return void
356 356
 	 */
357 357
 	public function load_sortable_question_script() {
358
-		wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
358
+		wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL.'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true);
359 359
 		wp_enqueue_script('ee-question-sortable');
360 360
 	}
361 361
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 				)
375 375
 		);
376 376
 
377
-		if ( EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) {
377
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) {
378 378
 			$this->_views['trash'] = array(
379 379
 				'slug' => 'trash',
380 380
 				'label' => __('Trash', 'event_espresso'),
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 				)
405 405
 		);
406 406
 
407
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups' ) ) {
407
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups')) {
408 408
 			$this->_views['trash'] = array(
409 409
 				'slug' => 'trash',
410 410
 				'label' => __('Trash', 'event_espresso'),
@@ -440,16 +440,16 @@  discard block
 block discarded – undo
440 440
 
441 441
 
442 442
 
443
-	protected function _delete_question(){
444
-		$success=$this->_question_model->delete_permanently_by_ID(intval($this->_req_data['QST_ID']));
445
-		$query_args=array('action'=>'default','status'=>'all');
443
+	protected function _delete_question() {
444
+		$success = $this->_question_model->delete_permanently_by_ID(intval($this->_req_data['QST_ID']));
445
+		$query_args = array('action'=>'default', 'status'=>'all');
446 446
 		$this->_redirect_after_action($success, $this->_question_model->item_name($success), 'deleted', $query_args);
447 447
 	}
448 448
 
449 449
 
450 450
 	protected function _delete_questions() {
451 451
 		$success = $this->_delete_items($this->_question_model);
452
-		$this->_redirect_after_action( $success, $this->_question_model->item_name($success), 'deleted permanently', array( 'action'=>'default', 'status'=>'trash' ));
452
+		$this->_redirect_after_action($success, $this->_question_model->item_name($success), 'deleted permanently', array('action'=>'default', 'status'=>'trash'));
453 453
 	}
454 454
 
455 455
 
@@ -458,27 +458,27 @@  discard block
 block discarded – undo
458 458
  * @param EEM_Base $model
459 459
  * @return int number of items deleted permanenetly
460 460
  */
461
-	private function _delete_items(EEM_Soft_Delete_Base $model){
461
+	private function _delete_items(EEM_Soft_Delete_Base $model) {
462 462
 		$success = 0;
463
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
464
-		if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
463
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
464
+		if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
465 465
 			// if array has more than one element than success message should be plural
466
-			$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
466
+			$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
467 467
 			// cycle thru bulk action checkboxes
468
-			while (list( $ID, $value ) = each($this->_req_data['checkbox'])) {
468
+			while (list($ID, $value) = each($this->_req_data['checkbox'])) {
469 469
 
470
-				if (!$model->delete_permanently_by_ID(absint($ID))) {
470
+				if ( ! $model->delete_permanently_by_ID(absint($ID))) {
471 471
 					$success = 0;
472 472
 				}
473 473
 			}
474 474
 
475
-		}elseif( !empty($this->_req_data['QSG_ID'])){
475
+		}elseif ( ! empty($this->_req_data['QSG_ID'])) {
476 476
 			$success = $model->delete_permanently_by_ID($this->_req_data['QSG_ID']);
477 477
 
478
-		}elseif( !empty($this->_req_data['QST_ID'])){
478
+		}elseif ( ! empty($this->_req_data['QST_ID'])) {
479 479
 			$success = $model->delete_permanently_by_ID($this->_req_data['QST_ID']);
480
-		}else{
481
-			EE_Error::add_error( sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ );
480
+		} else {
481
+			EE_Error::add_error(sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__);
482 482
 		}
483 483
 		return $success;
484 484
 	}
@@ -492,29 +492,29 @@  discard block
 block discarded – undo
492 492
 
493 493
 
494 494
 
495
-	protected function _edit_question_group( $type = 'add' ) {
496
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
497
-		$ID=isset( $this->_req_data['QSG_ID'] ) && ! empty( $this->_req_data['QSG_ID'] ) ? absint( $this->_req_data['QSG_ID'] ) : FALSE;
498
-		$this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action ));
495
+	protected function _edit_question_group($type = 'add') {
496
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
497
+		$ID = isset($this->_req_data['QSG_ID']) && ! empty($this->_req_data['QSG_ID']) ? absint($this->_req_data['QSG_ID']) : FALSE;
498
+		$this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action));
499 499
 		// add ID to title if editing
500
-		$this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title;
501
-		if($ID){
502
-			$questionGroup=$this->_question_group_model->get_one_by_ID($ID);
503
-			$additional_hidden_fields=array('QSG_ID'=>array('type'=>'hidden','value'=>$ID));
500
+		$this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title;
501
+		if ($ID) {
502
+			$questionGroup = $this->_question_group_model->get_one_by_ID($ID);
503
+			$additional_hidden_fields = array('QSG_ID'=>array('type'=>'hidden', 'value'=>$ID));
504 504
 			$this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields);
505
-		}else{
505
+		} else {
506 506
 			$questionGroup = EEM_Question_Group::instance()->create_default_object();
507 507
 			$questionGroup->set_order_to_latest();
508 508
 			$this->_set_add_edit_form_tags('insert_question_group');
509 509
 		}
510 510
 		$this->_template_args['values'] = $this->_yes_no_values;
511
-		$this->_template_args['all_questions']=$questionGroup->questions_in_and_not_in_group();
512
-		$this->_template_args['QSG_ID']=$ID ? $ID : TRUE;
513
-		$this->_template_args['question_group']=$questionGroup;
511
+		$this->_template_args['all_questions'] = $questionGroup->questions_in_and_not_in_group();
512
+		$this->_template_args['QSG_ID'] = $ID ? $ID : TRUE;
513
+		$this->_template_args['question_group'] = $questionGroup;
514 514
 
515
-		$redirect_URL = add_query_arg( array( 'action' => 'question_groups'), $this->_admin_base_url );
516
-		$this->_set_publish_post_box_vars( 'id', $ID, FALSE, $redirect_URL  );
517
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'question_groups_main_meta_box.template.php', $this->_template_args, TRUE );
515
+		$redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url);
516
+		$this->_set_publish_post_box_vars('id', $ID, FALSE, $redirect_URL);
517
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_CAF_TEMPLATE_PATH.'question_groups_main_meta_box.template.php', $this->_template_args, TRUE);
518 518
 
519 519
 		// the details template wrapper
520 520
 		$this->display_admin_page_with_sidebar();
@@ -525,76 +525,76 @@  discard block
 block discarded – undo
525 525
 
526 526
 	protected function _delete_question_groups() {
527 527
 		$success = $this->_delete_items($this->_question_group_model);
528
-		$this->_redirect_after_action( $success, $this->_question_group_model->item_name($success), 'deleted permanently', array( 'action'=>'question_groups', 'status'=>'trash' ));
528
+		$this->_redirect_after_action($success, $this->_question_group_model->item_name($success), 'deleted permanently', array('action'=>'question_groups', 'status'=>'trash'));
529 529
 	}
530 530
 
531 531
 
532 532
 
533
-	protected function _insert_or_update_question_group( $new_question_group = TRUE) {
534
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
535
-		$set_column_values=$this->_set_column_values_for($this->_question_group_model);
536
-		if ( $new_question_group ){
533
+	protected function _insert_or_update_question_group($new_question_group = TRUE) {
534
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
535
+		$set_column_values = $this->_set_column_values_for($this->_question_group_model);
536
+		if ($new_question_group) {
537 537
 			$QSG_ID = $this->_question_group_model->insert($set_column_values);
538 538
 			$success = $QSG_ID ? 1 : 0;
539 539
 		} else {
540 540
 			$QSG_ID = absint($this->_req_data['QSG_ID']);
541
-			unset( $set_column_values[ 'QSG_ID' ] );
542
-			$success= $this->_question_group_model->update( $set_column_values, array( array( 'QSG_ID' => $QSG_ID )));
541
+			unset($set_column_values['QSG_ID']);
542
+			$success = $this->_question_group_model->update($set_column_values, array(array('QSG_ID' => $QSG_ID)));
543 543
 		}
544
-		$phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string( EEM_Attendee::system_question_phone );
544
+		$phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string(EEM_Attendee::system_question_phone);
545 545
 		// update the existing related questions
546 546
 		// BUT FIRST...  delete the phone question from the Question_Group_Question if it is being added to this question group (therefore removed from the existing group)
547
-		if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ] )) {
547
+		if (isset($this->_req_data['questions'], $this->_req_data['questions'][$phone_question_id])) {
548 548
 			// delete where QST ID = system phone question ID and Question Group ID is NOT this group
549
-			EEM_Question_Group_Question::instance()->delete( array( array( 'QST_ID' => $phone_question_id, 'QSG_ID' => array( '!=', $QSG_ID ))));
549
+			EEM_Question_Group_Question::instance()->delete(array(array('QST_ID' => $phone_question_id, 'QSG_ID' => array('!=', $QSG_ID))));
550 550
 		}
551 551
 		/** @type EE_Question_Group $question_group */
552
-		$question_group=$this->_question_group_model->get_one_by_ID( $QSG_ID );
552
+		$question_group = $this->_question_group_model->get_one_by_ID($QSG_ID);
553 553
 		$questions = $question_group->questions();
554 554
 		// make sure system phone question is added to list of questions for this group
555
-		if ( ! isset( $questions[$phone_question_id ] )) {
556
-			$questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID( $phone_question_id );
555
+		if ( ! isset($questions[$phone_question_id])) {
556
+			$questions[$phone_question_id] = EEM_Question::instance()->get_one_by_ID($phone_question_id);
557 557
 		}
558 558
 
559
-		foreach( $questions as $question_ID => $question ){
559
+		foreach ($questions as $question_ID => $question) {
560 560
 			// first we always check for order.
561
-			if ( ! empty( $this->_req_data['question_orders'][ $question_ID ] ) ){
561
+			if ( ! empty($this->_req_data['question_orders'][$question_ID])) {
562 562
 				//update question order
563
-				$question_group->update_question_order( $question_ID, $this->_req_data['question_orders'][ $question_ID ] );
563
+				$question_group->update_question_order($question_ID, $this->_req_data['question_orders'][$question_ID]);
564 564
 			}
565 565
 
566 566
 			// then we always check if adding or removing.
567
-			if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ] )) {
568
-				$question_group->add_question( $question_ID );
567
+			if (isset($this->_req_data['questions'], $this->_req_data['questions'][$question_ID])) {
568
+				$question_group->add_question($question_ID);
569 569
 			} else {
570 570
 				// not found, remove it (but only if not a system question for the personal group with the exception of lname system question - we allow removal of it)
571 571
 				if (
572 572
 					in_array(
573 573
 						$question->system_ID(),
574
-						EEM_Question::instance()->required_system_questions_in_system_question_group( $question_group->system_group() )
574
+						EEM_Question::instance()->required_system_questions_in_system_question_group($question_group->system_group())
575 575
 					)
576 576
 				) {
577 577
 					continue;
578 578
 				} else {
579
-					$question_group->remove_question( $question_ID );
579
+					$question_group->remove_question($question_ID);
580 580
 				}
581 581
 			}
582 582
 		}
583 583
 		// save new related questions
584
-		if ( isset( $this->_req_data['questions'] )) {
585
-			foreach( $this->_req_data['questions'] as $QST_ID ){
586
-				$question_group->add_question( $QST_ID );
587
-				if ( isset( $this->_req_data['question_orders'][ $QST_ID ] )) {
588
-					$question_group->update_question_order( $QST_ID, $this->_req_data['question_orders'][ $QST_ID ] );
584
+		if (isset($this->_req_data['questions'])) {
585
+			foreach ($this->_req_data['questions'] as $QST_ID) {
586
+				$question_group->add_question($QST_ID);
587
+				if (isset($this->_req_data['question_orders'][$QST_ID])) {
588
+					$question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][$QST_ID]);
589 589
 				}
590 590
 			}
591 591
 		}
592 592
 
593
-		if ( $success !== FALSE ) {
594
-			$msg = $new_question_group ? sprintf( __('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name() ) : sprintf( __('The %s has been updated', 'event_espresso' ), $this->_question_group_model->item_name() );
595
-			EE_Error::add_success( $msg );
593
+		if ($success !== FALSE) {
594
+			$msg = $new_question_group ? sprintf(__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name()) : sprintf(__('The %s has been updated', 'event_espresso'), $this->_question_group_model->item_name());
595
+			EE_Error::add_success($msg);
596 596
 		}
597
-		$this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group','QSG_ID'=>$QSG_ID), TRUE);
597
+		$this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group', 'QSG_ID'=>$QSG_ID), TRUE);
598 598
 
599 599
 	}
600 600
 
@@ -602,39 +602,39 @@  discard block
 block discarded – undo
602 602
 	 * duplicates a question and all its question options and redirects to the new question.
603 603
 	 */
604 604
 	public function _duplicate_question() {
605
-		$question_ID = intval( $this->_req_data[ 'QST_ID' ] );
606
-		$question = EEM_Question::instance()->get_one_by_ID( $question_ID );
607
-		if( $question instanceof EE_Question ) {
605
+		$question_ID = intval($this->_req_data['QST_ID']);
606
+		$question = EEM_Question::instance()->get_one_by_ID($question_ID);
607
+		if ($question instanceof EE_Question) {
608 608
 			$new_question = $question->duplicate();
609
-			if( $new_question instanceof EE_Question ) {
610
-				$this->_redirect_after_action( true, __( 'Question', 'event_espresso' ), __( 'Duplicated', 'event_espresso' ), array('action'=>'edit_question', 'QST_ID' => $new_question->ID() ), TRUE);
609
+			if ($new_question instanceof EE_Question) {
610
+				$this->_redirect_after_action(true, __('Question', 'event_espresso'), __('Duplicated', 'event_espresso'), array('action'=>'edit_question', 'QST_ID' => $new_question->ID()), TRUE);
611 611
 			} else {
612 612
 				global $wpdb;
613
-				EE_Error::add_error( sprintf( __( 'Could not duplicate question with ID %1$d because: %2$s', 'event_espresso' ), $question_ID, $wpdb->last_error ), __FILE__, __FUNCTION__, __LINE__ );
614
-			$this->_redirect_after_action(false, '', '', array('action'=>'default'), false );
613
+				EE_Error::add_error(sprintf(__('Could not duplicate question with ID %1$d because: %2$s', 'event_espresso'), $question_ID, $wpdb->last_error), __FILE__, __FUNCTION__, __LINE__);
614
+			$this->_redirect_after_action(false, '', '', array('action'=>'default'), false);
615 615
 			}
616 616
 		} else {
617
-			EE_Error::add_error( sprintf( __( 'Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso' ), $question_ID ), __FILE__, __FUNCTION__, __LINE__ );
618
-			$this->_redirect_after_action( false, '', '', array( 'action' => 'default' ), false );
617
+			EE_Error::add_error(sprintf(__('Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso'), $question_ID), __FILE__, __FUNCTION__, __LINE__);
618
+			$this->_redirect_after_action(false, '', '', array('action' => 'default'), false);
619 619
 		}
620 620
 	}
621 621
 
622 622
 
623 623
 
624 624
 	protected function _trash_or_restore_question_groups($trash = TRUE) {
625
-		return $this->_trash_or_restore_items( $this->_question_group_model, $trash );
625
+		return $this->_trash_or_restore_items($this->_question_group_model, $trash);
626 626
 	}
627 627
 
628
-	protected function _trash_question(){
629
-		$success=$this->_question_model->delete_by_ID(intval($this->_req_data['QST_ID']));
630
-		$query_args=array('action'=>'default','status'=>'all');
628
+	protected function _trash_question() {
629
+		$success = $this->_question_model->delete_by_ID(intval($this->_req_data['QST_ID']));
630
+		$query_args = array('action'=>'default', 'status'=>'all');
631 631
 		$this->_redirect_after_action($success, $this->_question_model->item_name($success), 'trashed', $query_args);
632 632
 	}
633 633
 
634 634
 
635 635
 
636
-	protected function _trash_or_restore_questions($trash=TRUE){
637
-		$this->_trash_or_restore_items( $this->_question_model, $trash );
636
+	protected function _trash_or_restore_questions($trash = TRUE) {
637
+		$this->_trash_or_restore_items($this->_question_model, $trash);
638 638
 	}
639 639
 
640 640
 
@@ -645,21 +645,21 @@  discard block
 block discarded – undo
645 645
 	 * @param EEM_Base $model
646 646
 	 * @param boolean $trash wehter to trash or restore
647 647
 	 */
648
-	private function _trash_or_restore_items( EEM_Base $model, $trash = TRUE ) {
648
+	private function _trash_or_restore_items(EEM_Base $model, $trash = TRUE) {
649 649
 
650
-		do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' );
650
+		do_action('AHEE_log', __FILE__, __FUNCTION__, '');
651 651
 
652 652
 		$success = 1;
653 653
 		//Checkboxes
654 654
 		//echo "trash $trash";
655 655
 		//var_dump($this->_req_data['checkbox']);die;
656
-		if ( isset( $this->_req_data['checkbox'] )) {
657
-			if ( isset( $this->_req_data['checkbox'] ) && ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) {
656
+		if (isset($this->_req_data['checkbox'])) {
657
+			if (isset($this->_req_data['checkbox']) && ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) {
658 658
 				// if array has more than one element than success message should be plural
659
-				$success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1;
659
+				$success = count($this->_req_data['checkbox']) > 1 ? 2 : 1;
660 660
 				// cycle thru bulk action checkboxes
661
-				while (list( $ID, $value ) = each($this->_req_data['checkbox'])) {
662
-					if ( ! $model->delete_or_restore_by_ID($trash,absint($ID))) {
661
+				while (list($ID, $value) = each($this->_req_data['checkbox'])) {
662
+					if ( ! $model->delete_or_restore_by_ID($trash, absint($ID))) {
663 663
 						$success = 0;
664 664
 					}
665 665
 				}
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 			} else {
668 668
 				// grab single id and delete
669 669
 				$ID = absint($this->_req_data['checkbox']);
670
-				if ( ! $model->delete_or_restore_by_ID($trash,$ID)) {
670
+				if ( ! $model->delete_or_restore_by_ID($trash, $ID)) {
671 671
 					$success = 0;
672 672
 				}
673 673
 			}
@@ -675,53 +675,53 @@  discard block
 block discarded – undo
675 675
 		} else {
676 676
 			// delete via trash link
677 677
 			// grab single id and delete
678
-			$ID = absint($this->_req_data[ $model->primary_key_name() ]);
679
-			if ( ! $model->delete_or_restore_by_ID($trash,$ID)) {
678
+			$ID = absint($this->_req_data[$model->primary_key_name()]);
679
+			if ( ! $model->delete_or_restore_by_ID($trash, $ID)) {
680 680
 				$success = 0;
681 681
 			}
682 682
 
683 683
 		}
684 684
 
685 685
 
686
-		$action = $model instanceof EEM_Question ? 'default' : 'question_groups';//strtolower( $model->item_name(2) );
686
+		$action = $model instanceof EEM_Question ? 'default' : 'question_groups'; //strtolower( $model->item_name(2) );
687 687
 		//echo "action :$action";
688 688
 		//$action = 'questions' ? 'default' : $action;
689
-		if($trash){
689
+		if ($trash) {
690 690
 			$action_desc = 'trashed';
691 691
 			$status = 'trash';
692
-		}else{
692
+		} else {
693 693
 			$action_desc = 'restored';
694 694
 			$status = 'all';
695 695
 		}
696
-		$this->_redirect_after_action( $success, $model->item_name($success), $action_desc, array( 'action' => $action, 'status'=>$status ) );
696
+		$this->_redirect_after_action($success, $model->item_name($success), $action_desc, array('action' => $action, 'status'=>$status));
697 697
 	}
698 698
 
699 699
 
700 700
 
701 701
 
702
-	public function get_trashed_questions( $per_page,$current_page = 1, $count = FALSE ) {
702
+	public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) {
703 703
 		$query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page);
704 704
 
705
-		if( $count ){
705
+		if ($count) {
706 706
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
707
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
708
-			$results=$this->_question_model->count_deleted($where);
709
-		}else{
707
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
708
+			$results = $this->_question_model->count_deleted($where);
709
+		} else {
710 710
 			//note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items
711
-			$results=$this->_question_model->get_all_deleted($query_params);
711
+			$results = $this->_question_model->get_all_deleted($query_params);
712 712
 		}
713 713
 		return $results;
714 714
 	}
715 715
 
716 716
 
717 717
 
718
-	public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) {
719
-		$questionGroupModel=EEM_Question_Group::instance();
720
-		$query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page);
721
-		if ($count){
722
-			$where = isset( $query_params[0] ) ? array( $query_params[0] ) : array();
718
+	public function get_question_groups($per_page, $current_page = 1, $count = FALSE) {
719
+		$questionGroupModel = EEM_Question_Group::instance();
720
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
721
+		if ($count) {
722
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
723 723
 			$results = $questionGroupModel->count($where);
724
-		}else{
724
+		} else {
725 725
 			$results = $questionGroupModel->get_all($query_params);
726 726
 		}
727 727
 		return $results;
@@ -729,14 +729,14 @@  discard block
 block discarded – undo
729 729
 
730 730
 
731 731
 
732
-	public function get_trashed_question_groups( $per_page,$current_page = 1, $count = FALSE ) {
733
-		$questionGroupModel=EEM_Question_Group::instance();
734
-		$query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page);
735
-		if($count){
736
-			$where = isset( $query_params[0] ) ? array($query_params[0]) : array();
732
+	public function get_trashed_question_groups($per_page, $current_page = 1, $count = FALSE) {
733
+		$questionGroupModel = EEM_Question_Group::instance();
734
+		$query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page);
735
+		if ($count) {
736
+			$where = isset($query_params[0]) ? array($query_params[0]) : array();
737 737
 			$query_params['limit'] = NULL;
738 738
 			$results = $questionGroupModel->count_deleted($where);
739
-		}else{
739
+		} else {
740 740
 			$results = $questionGroupModel->get_all_deleted($query_params);
741 741
 		}
742 742
 		return $results;
@@ -749,22 +749,22 @@  discard block
 block discarded – undo
749 749
 	 */
750 750
 	public function update_question_group_order() {
751 751
 
752
-		$success = __( 'Question group order was updated successfully.', 'event_espresso' );
752
+		$success = __('Question group order was updated successfully.', 'event_espresso');
753 753
 
754 754
 		// grab our row IDs
755
-		$row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE;
755
+		$row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE;
756 756
 
757
-		$perpage = !empty( $this->_req_data['perpage'] ) ? (int) $this->_req_data['perpage'] : NULL;
758
-		$curpage = !empty( $this->_req_data['curpage'] ) ? (int) $this->_req_data['curpage'] : NULL;
757
+		$perpage = ! empty($this->_req_data['perpage']) ? (int) $this->_req_data['perpage'] : NULL;
758
+		$curpage = ! empty($this->_req_data['curpage']) ? (int) $this->_req_data['curpage'] : NULL;
759 759
 
760
-		if ( is_array( $row_ids )) {
760
+		if (is_array($row_ids)) {
761 761
 			//figure out where we start the row_id count at for the current page.
762
-			$qsgcount = empty( $curpage ) ? 0 : ($curpage - 1 ) * $perpage;
762
+			$qsgcount = empty($curpage) ? 0 : ($curpage - 1) * $perpage;
763 763
 
764 764
 			global $wpdb;
765
-			for ( $i = 0; $i < count($row_ids); $i++ ) {
765
+			for ($i = 0; $i < count($row_ids); $i++) {
766 766
 				//Update the questions when re-ordering
767
-				if ( EEM_Question_Group::instance()->update ( array( 'QSG_order' => $qsgcount ), array(array( 'QSG_ID' => $row_ids[$i] ))) === FALSE ) {
767
+				if (EEM_Question_Group::instance()->update(array('QSG_order' => $qsgcount), array(array('QSG_ID' => $row_ids[$i]))) === FALSE) {
768 768
 					$success = FALSE;
769 769
 				}
770 770
 				$qsgcount++;
@@ -773,9 +773,9 @@  discard block
 block discarded – undo
773 773
 			$success = FALSE;
774 774
 		}
775 775
 
776
-		$errors = ! $success ? __( 'An error occurred. The question group order was not updated.', 'event_espresso' ) : FALSE;
776
+		$errors = ! $success ? __('An error occurred. The question group order was not updated.', 'event_espresso') : FALSE;
777 777
 
778
-		echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors ));
778
+		echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors));
779 779
 		die();
780 780
 
781 781
 	}
@@ -792,10 +792,10 @@  discard block
 block discarded – undo
792 792
 
793 793
 	protected function _reg_form_settings() {
794 794
 		$this->_template_args['values'] = $this->_yes_no_values;
795
-		$this->_template_args = apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args', $this->_template_args );
796
-		$this->_set_add_edit_form_tags( 'update_reg_form_settings' );
797
-		$this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE );
798
-		$this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php', $this->_template_args, TRUE );
795
+		$this->_template_args = apply_filters('FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args', $this->_template_args);
796
+		$this->_set_add_edit_form_tags('update_reg_form_settings');
797
+		$this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE);
798
+		$this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_CAF_TEMPLATE_PATH.'reg_form_settings.template.php', $this->_template_args, TRUE);
799 799
 		$this->display_admin_page_with_sidebar();
800 800
 	}
801 801
 
@@ -803,9 +803,9 @@  discard block
 block discarded – undo
803 803
 
804 804
 
805 805
 	protected function _update_reg_form_settings() {
806
-		EE_Registry::instance()->CFG->registration = apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', EE_Registry::instance()->CFG->registration );
807
-		$success = $this->_update_espresso_configuration( __('Registration Form Options', 'event_espresso'), EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__ );
808
-		$this->_redirect_after_action( $success, __('Registration Form Options', 'event_espresso'), 'updated', array( 'action' => 'view_reg_form_settings' ) );
806
+		EE_Registry::instance()->CFG->registration = apply_filters('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', EE_Registry::instance()->CFG->registration);
807
+		$success = $this->_update_espresso_configuration(__('Registration Form Options', 'event_espresso'), EE_Registry::instance()->CFG, __FILE__, __FUNCTION__, __LINE__);
808
+		$this->_redirect_after_action($success, __('Registration Form Options', 'event_espresso'), 'updated', array('action' => 'view_reg_form_settings'));
809 809
 	}
810 810
 
811 811
 }
Please login to merge, or discard this patch.
Extend_Registration_Form_Questions_Admin_List_Table.class.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -31,15 +31,15 @@  discard block
 block discarded – undo
31 31
 
32 32
 class Extend_Registration_Form_Questions_Admin_List_Table extends Registration_Form_Questions_Admin_List_Table {
33 33
 
34
-	public function __construct( $admin_page ) {
35
-		parent::__construct( $admin_page );
34
+	public function __construct($admin_page) {
35
+		parent::__construct($admin_page);
36 36
 	}
37 37
 
38 38
 	public function column_display_text(EE_Question $item) {
39 39
 		$system_question = $item->is_system_question();
40 40
 		$actions = array();
41 41
 
42
-		if ( !defined('REG_ADMIN_URL') )
42
+		if ( ! defined('REG_ADMIN_URL'))
43 43
 			define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
44 44
 
45 45
 		$edit_query_args = array(
@@ -67,35 +67,35 @@  discard block
 block discarded – undo
67 67
 				'QST_ID' => $item->ID()
68 68
 			);
69 69
 
70
-		$edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EE_FORMS_ADMIN_URL );
71
-		$trash_link = EE_Admin_Page::add_query_args_and_nonce( $trash_query_args, EE_FORMS_ADMIN_URL );
72
-		$restore_link = EE_Admin_Page::add_query_args_and_nonce( $restore_query_args, EE_FORMS_ADMIN_URL );
73
-		$delete_link = EE_Admin_Page::add_query_args_and_nonce( $delete_query_args, EE_FORMS_ADMIN_URL );
74
-		$duplicate_link = EE_Admin_Page::add_query_args_and_nonce( $duplicate_query_args, EE_FORMS_ADMIN_URL );
70
+		$edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
71
+		$trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL);
72
+		$restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL);
73
+		$delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL);
74
+		$duplicate_link = EE_Admin_Page::add_query_args_and_nonce($duplicate_query_args, EE_FORMS_ADMIN_URL);
75 75
 
76
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_question', 'espresso_registration_form_edit_question', $item->ID() ) ) {
76
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_question', 'espresso_registration_form_edit_question', $item->ID())) {
77 77
 			$actions = array(
78
-				'edit' => '<a href="' . $edit_link . '" title="' . __('Edit Question', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>'
78
+				'edit' => '<a href="'.$edit_link.'" title="'.__('Edit Question', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'
79 79
 			);
80 80
 		}
81 81
 
82
-		if ( ! $system_question && $this->_view != 'trash' && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question', 'espresso_registration_form_trash_question', $item->ID() ) ) {
83
-			$actions['delete'] = '<a href="' . $trash_link . '" title="' . __('Trash Question', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
82
+		if ( ! $system_question && $this->_view != 'trash' && EE_Registry::instance()->CAP->current_user_can('ee_delete_question', 'espresso_registration_form_trash_question', $item->ID())) {
83
+			$actions['delete'] = '<a href="'.$trash_link.'" title="'.__('Trash Question', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>';
84 84
 		}
85 85
 
86
-		if ( $this->_view == 'trash' ) {
87
-			if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question', 'espresso_registration_form_restore_question', $item->ID() ) ) {
88
-				$actions['restore'] = '<a href="' . $restore_link . '" title="' . __('Restore Question', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
86
+		if ($this->_view == 'trash') {
87
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question', 'espresso_registration_form_restore_question', $item->ID())) {
88
+				$actions['restore'] = '<a href="'.$restore_link.'" title="'.__('Restore Question', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
89 89
 			}
90
-			if ( $item->count_related('Answer') === 0 && EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question', 'espresso_registration_form_delete_questions', $item->ID() ) ) {
91
-				$actions['delete'] = '<a href="' . $delete_link . '" title="' . __('Delete Question Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>';
90
+			if ($item->count_related('Answer') === 0 && EE_Registry::instance()->CAP->current_user_can('ee_delete_question', 'espresso_registration_form_delete_questions', $item->ID())) {
91
+				$actions['delete'] = '<a href="'.$delete_link.'" title="'.__('Delete Question Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>';
92 92
 			}
93 93
 		}
94
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_questions', 'espresso_registration_form_edit_question' ) ) {
95
-			$actions[ 'duplicate' ] = '<a href="' . $duplicate_link . '" title="' . __('Duplicate Question', 'event_espresso') . '">' . __('Duplicate', 'event_espresso') . '</a>';
94
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_questions', 'espresso_registration_form_edit_question')) {
95
+			$actions['duplicate'] = '<a href="'.$duplicate_link.'" title="'.__('Duplicate Question', 'event_espresso').'">'.__('Duplicate', 'event_espresso').'</a>';
96 96
 		}
97 97
 
98
-		$content = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_question', 'espresso_registration_form_edit_question', $item->ID() ) ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->display_text() . '</a></strong>' : $item->display_text();
98
+		$content = EE_Registry::instance()->CAP->current_user_can('ee_edit_question', 'espresso_registration_form_edit_question', $item->ID()) ? '<strong><a class="row-title" href="'.$edit_link.'">'.$item->display_text().'</a></strong>' : $item->display_text();
99 99
 		$content .= $this->row_actions($actions);
100 100
 		return $content;
101 101
 	}
Please login to merge, or discard this patch.
Registration_Form_Question_Groups_Admin_List_Table.class.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 class Registration_Form_Question_Groups_Admin_List_Table extends EE_Admin_List_Table {
32 32
 
33 33
 
34
-	public function __construct( $admin_page ) {
34
+	public function __construct($admin_page) {
35 35
 		parent::__construct($admin_page);
36 36
 	}
37 37
 
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
 
41 41
 	protected function _setup_data() {
42
-		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, FALSE ) : $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, FALSE );
43
-		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, TRUE ) : $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, TRUE );
42
+		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, FALSE) : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, FALSE);
43
+		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, TRUE) : $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, TRUE);
44 44
 	}
45 45
 
46 46
 
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
 
50 50
 	protected function _set_properties() {
51 51
 		$this->_wp_list_args = array(
52
-			'singular' => __('question group', 'event_espresso' ),
53
-			'plural' => __('question groups', 'event_espresso' ),
52
+			'singular' => __('question group', 'event_espresso'),
53
+			'plural' => __('question groups', 'event_espresso'),
54 54
 			'ajax' => TRUE, //for now,
55 55
 			'screen' => $this->_admin_page->get_current_screen()->id
56 56
 			);
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 			);
66 66
 
67 67
 		$this->_sortable_columns = array(
68
-			'id' => array( 'QSG_ID' => FALSE ),
69
-			'name' => array( 'QSG_name' => FALSE )
68
+			'id' => array('QSG_ID' => FALSE),
69
+			'name' => array('QSG_name' => FALSE)
70 70
 			);
71 71
 
72 72
 		$this->_hidden_columns = array(
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 
93 93
 
94 94
 	protected function _add_view_counts() {
95
-		$this->_views['all']['count'] = $this->_admin_page->get_question_groups( $this->_per_page,$this->_current_page, TRUE );
96
-		if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_group' ) ) {
97
-			$this->_views['trash']['count'] = $this->_admin_page->get_trashed_question_groups( $this->_per_page,$this->_current_page, TRUE );
95
+		$this->_views['all']['count'] = $this->_admin_page->get_question_groups($this->_per_page, $this->_current_page, TRUE);
96
+		if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_group')) {
97
+			$this->_views['trash']['count'] = $this->_admin_page->get_trashed_question_groups($this->_per_page, $this->_current_page, TRUE);
98 98
 		}
99 99
 	}
100 100
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		$system_group = $item->get('QSG_system');
108 108
 		$has_questions_with_answers = $item->has_questions_with_answers();
109 109
 		$lock_icon = $system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers ? 'ee-lock-icon ee-alternate-color' : 'ee-lock-icon ee-system-lock';
110
-		return $system_group > 0 || ( $system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers ) || ! EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups' ) ? '<span class="' . $lock_icon . '"></span>'  . sprintf( '<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', $item->ID() )  : sprintf( '<input type="checkbox" id="QSG_ID[%1$d]" name="checkbox[%1$d]" value="%1$d" />', $item->ID() );
110
+		return $system_group > 0 || ($system_group === 0 && $this->_view == 'trash' && $has_questions_with_answers) || ! EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups') ? '<span class="'.$lock_icon.'"></span>'.sprintf('<input type="hidden" name="hdnchk[%1$d]" value="%1$d" />', $item->ID()) : sprintf('<input type="checkbox" id="QSG_ID[%1$d]" name="checkbox[%1$d]" value="%1$d" />', $item->ID());
111 111
 	}
112 112
 
113 113
 
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 
118 118
 	public function column_id(EE_Question_Group $item) {
119 119
 		$content = $item->ID();
120
-		$content .= '  <span class="show-on-mobile-view-only">' .$item->name() . '</span>';
120
+		$content .= '  <span class="show-on-mobile-view-only">'.$item->name().'</span>';
121 121
 		return $content;
122 122
 	}
123 123
 
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		$actions = array();
128 128
 
129 129
 		//return $item->name();
130
-		if ( !defined('REG_ADMIN_URL') )
130
+		if ( ! defined('REG_ADMIN_URL'))
131 131
 			define('REG_ADMIN_URL', EVENTS_ADMIN_URL);
132 132
 
133 133
 		$edit_query_args = array(
@@ -152,32 +152,32 @@  discard block
 block discarded – undo
152 152
 
153 153
 
154 154
 
155
-		$edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EE_FORMS_ADMIN_URL );
156
-		$trash_link = EE_Admin_Page::add_query_args_and_nonce( $trash_query_args, EE_FORMS_ADMIN_URL );
157
-		$restore_link = EE_Admin_Page::add_query_args_and_nonce( $restore_query_args, EE_FORMS_ADMIN_URL );
158
-		$delete_link = EE_Admin_Page::add_query_args_and_nonce( $delete_query_args, EE_FORMS_ADMIN_URL );
155
+		$edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL);
156
+		$trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL);
157
+		$restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL);
158
+		$delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL);
159 159
 
160
-		if (  EE_Registry::instance()->CAP->current_user_can( 'ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID() ) ) {
160
+		if (EE_Registry::instance()->CAP->current_user_can('ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID())) {
161 161
 			$actions = array(
162
-				'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Question Group', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>'
162
+				'edit' => '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Question Group', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>'
163 163
 			);
164 164
 		}
165
-		if ( $item->get('QSG_system') < 1 && $this->_view != 'trash' &&  EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_trash_question_group', $item->ID() ) ) {
166
-			$actions['delete'] = '<a href="' . $trash_link . '" title="' . esc_attr__('Delete Question Group', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>';
165
+		if ($item->get('QSG_system') < 1 && $this->_view != 'trash' && EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_trash_question_group', $item->ID())) {
166
+			$actions['delete'] = '<a href="'.$trash_link.'" title="'.esc_attr__('Delete Question Group', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>';
167 167
 		}
168 168
 
169
-		if ( $this->_view == 'trash' ) {
169
+		if ($this->_view == 'trash') {
170 170
 
171
-			if (  EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_restore_question_group', $item->ID() ) ) {
172
-				$actions['restore'] = '<a href="' . $restore_link . '" title="' . esc_attr__('Restore Question Group', 'event_espresso') . '">' . __('Restore', 'event_espresso') . '</a>';
171
+			if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_restore_question_group', $item->ID())) {
172
+				$actions['restore'] = '<a href="'.$restore_link.'" title="'.esc_attr__('Restore Question Group', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>';
173 173
 			}
174 174
 
175
-			if ( !$item->has_questions_with_answers() &&  EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_group', 'espresso_registration_form_delete_question_group', $item->ID() ) ) {
176
-				$actions['delete'] = '<a href="' . $delete_link . '" title="' . esc_attr__('Delete Question Group Permanently', 'event_espresso') . '">' . __('Delete Permanently', 'event_espresso') . '</a>';
175
+			if ( ! $item->has_questions_with_answers() && EE_Registry::instance()->CAP->current_user_can('ee_delete_question_group', 'espresso_registration_form_delete_question_group', $item->ID())) {
176
+				$actions['delete'] = '<a href="'.$delete_link.'" title="'.esc_attr__('Delete Question Group Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>';
177 177
 			}
178 178
 		}
179 179
 
180
-		$content =  EE_Registry::instance()->CAP->current_user_can( 'ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID() ) ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->name() . '</a></strong>' : $item->name();
180
+		$content = EE_Registry::instance()->CAP->current_user_can('ee_edit_question_group', 'espresso_registration_form_edit_question_group', $item->ID()) ? '<strong><a class="row-title" href="'.$edit_link.'">'.$item->name().'</a></strong>' : $item->name();
181 181
 		$content .= $this->row_actions($actions);
182 182
 		return $content;
183 183
 	}
@@ -198,13 +198,13 @@  discard block
 block discarded – undo
198 198
 
199 199
 
200 200
 	public function column_show_group_name(EE_Question_Group $item) {
201
-		return $this->_yes_no[ $item->show_group_name() ];
201
+		return $this->_yes_no[$item->show_group_name()];
202 202
 	}
203 203
 
204 204
 
205 205
 
206 206
 	public function column_show_group_desc(EE_Question_Group $item) {
207
-		return $this->_yes_no[ $item->show_group_desc() ];
207
+		return $this->_yes_no[$item->show_group_desc()];
208 208
 	}
209 209
 
210 210
 
Please login to merge, or discard this patch.
registration_form/espresso_events_Registration_Form_Hooks_Extend.class.php 1 patch
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if (!defined('EVENT_ESPRESSO_VERSION') )
2
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
3 3
 	exit('NO direct script access allowed');
4 4
 
5 5
 /**
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 class espresso_events_Registration_Form_Hooks_Extend extends espresso_events_Registration_Form_Hooks {
31 31
 
32 32
 
33
-	public function __construct( EE_Admin_Page $admin_page ) {
33
+	public function __construct(EE_Admin_Page $admin_page) {
34 34
 		parent::__construct($admin_page);
35 35
 	}
36 36
 
@@ -54,31 +54,31 @@  discard block
 block discarded – undo
54 54
 				)
55 55
 			);
56 56
 
57
-		$this->_metaboxes = array_merge( $this->_metaboxes, $new_metaboxes);
57
+		$this->_metaboxes = array_merge($this->_metaboxes, $new_metaboxes);
58 58
 	}
59 59
 
60 60
 
61 61
 
62 62
 
63
-	public function modify_callbacks( $callbacks ) {
64
-		$callbacks = parent::modify_callbacks( $callbacks );
65
-		$callbacks[] = array( $this, 'additional_question_group_update' );
63
+	public function modify_callbacks($callbacks) {
64
+		$callbacks = parent::modify_callbacks($callbacks);
65
+		$callbacks[] = array($this, 'additional_question_group_update');
66 66
 		return $callbacks;
67 67
 	}
68 68
 
69 69
 
70 70
 
71
-	public function restore_revision( $post_id, $revision_id ) {
72
-		$post_evt = parent::restore_revision( $post_id, $revision_id );
71
+	public function restore_revision($post_id, $revision_id) {
72
+		$post_evt = parent::restore_revision($post_id, $revision_id);
73 73
 
74 74
 		//restore revision for additional questions
75
-		$post_evt->restore_revision( $revision_id, array('Question_Group'), array('Question_Group' => array('Event_Question_Group.EQG_primary' => 0 ) ) );
75
+		$post_evt->restore_revision($revision_id, array('Question_Group'), array('Question_Group' => array('Event_Question_Group.EQG_primary' => 0)));
76 76
 	}
77 77
 
78 78
 
79 79
 
80 80
 
81
-	public function additional_questions( $post_id, $post ) {
81
+	public function additional_questions($post_id, $post) {
82 82
 		$this->_event = $this->_adminpage_obj->get_event_object();
83 83
 		$event_id = $this->_event->ID();
84 84
 		?>
@@ -95,32 +95,32 @@  discard block
 block discarded – undo
95 95
 			<?php
96 96
 
97 97
 			$qsg_where['QSG_deleted'] = FALSE;
98
-			$query_params = array( $qsg_where, 'order_by' => array( 'QSG_order' => 'ASC' ) );
99
-			$QSGs = EEM_Question_Group::instance()->get_all( $query_params );
100
-			$EQGs = !empty( $event_id ) ? $this->_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0 )) ) : array();
98
+			$query_params = array($qsg_where, 'order_by' => array('QSG_order' => 'ASC'));
99
+			$QSGs = EEM_Question_Group::instance()->get_all($query_params);
100
+			$EQGs = ! empty($event_id) ? $this->_event->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0))) : array();
101 101
 			$EQGids = array_keys($EQGs);
102 102
 
103
-			if ( ! empty( $QSGs )) {
104
- 				$html = count( $QSGs ) > 10 ? '<div style="height:250px;overflow:auto;">' : '';
105
-				foreach ( $QSGs as $QSG ) {
103
+			if ( ! empty($QSGs)) {
104
+ 				$html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : '';
105
+				foreach ($QSGs as $QSG) {
106 106
 
107
-					$checked = in_array( $QSG->ID(), $EQGids ) ? ' checked="checked" ' : '';
108
-					$edit_link = $this->_adminpage_obj->add_query_args_and_nonce( array( 'action' => 'edit_question_group', 'QSG_ID' => $QSG->ID() ), EE_FORMS_ADMIN_URL );
107
+					$checked = in_array($QSG->ID(), $EQGids) ? ' checked="checked" ' : '';
108
+					$edit_link = $this->_adminpage_obj->add_query_args_and_nonce(array('action' => 'edit_question_group', 'QSG_ID' => $QSG->ID()), EE_FORMS_ADMIN_URL);
109 109
 
110 110
 					$html .= '
111
-					<p id="event-question-group-' . $QSG->ID() . '">
112
-						<input value="' . $QSG->ID() . '" type="checkbox" name="add_attendee_question_groups[' . $QSG->ID() . ']"' . $checked . ' />
113
-						<a href="' . $edit_link . '" title="' . sprintf( esc_attr__( 'Edit %s Group', 'event_espresso' ),  $QSG->get('QSG_name') ) . '" target="_blank">' . $QSG->get('QSG_name') . '</a>
111
+					<p id="event-question-group-' . $QSG->ID().'">
112
+						<input value="' . $QSG->ID().'" type="checkbox" name="add_attendee_question_groups['.$QSG->ID().']"'.$checked.' />
113
+						<a href="' . $edit_link.'" title="'.sprintf(esc_attr__('Edit %s Group', 'event_espresso'), $QSG->get('QSG_name')).'" target="_blank">'.$QSG->get('QSG_name').'</a>
114 114
 					</p>';
115 115
 				}
116
-				$html .= count( $QSGs ) > 10 ? '</div>' : '';
116
+				$html .= count($QSGs) > 10 ? '</div>' : '';
117 117
 
118 118
 				echo $html;
119 119
 
120 120
 			} else {
121 121
 				echo __('There seems to be a problem with your questions. Please contact [email protected]', 'event_espresso');
122 122
 			}
123
-			do_action( 'AHEE__espresso_events_Registration_Form_Hooks__additional_questions__after_content' );
123
+			do_action('AHEE__espresso_events_Registration_Form_Hooks__additional_questions__after_content');
124 124
 			?>
125 125
 		</div>
126 126
 		<?php
@@ -130,31 +130,31 @@  discard block
 block discarded – undo
130 130
 
131 131
 
132 132
 
133
-	public function additional_question_group_update( $evtobj, $data ) {
134
-		$question_groups = !empty( $data['add_attendee_question_groups'] ) ? (array) $data['add_attendee_question_groups'] : array();
133
+	public function additional_question_group_update($evtobj, $data) {
134
+		$question_groups = ! empty($data['add_attendee_question_groups']) ? (array) $data['add_attendee_question_groups'] : array();
135 135
 		$added_qgs = array_keys($question_groups);
136 136
 		$success = array();
137 137
 
138 138
 		//let's get all current question groups associated with this event.
139
-		$current_qgs = $evtobj->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0) ) );
139
+		$current_qgs = $evtobj->get_many_related('Question_Group', array(array('Event_Question_Group.EQG_primary' => 0)));
140 140
 		$current_qgs = array_keys($current_qgs); //we just want the ids
141 141
 
142 142
 		//now let's get the groups selected in the editor and update (IF we have data)
143
-		if ( !empty( $question_groups ) ) {
144
-			foreach ( $question_groups as $id => $val ) {
143
+		if ( ! empty($question_groups)) {
144
+			foreach ($question_groups as $id => $val) {
145 145
 				//add to event
146
-				if ( $val )
147
-					$qg = $evtobj->_add_relation_to( $id, 'Question_Group', array('EQG_primary' => 0) );
148
-				$success[] = !empty($qg) ? 1 : 0;
146
+				if ($val)
147
+					$qg = $evtobj->_add_relation_to($id, 'Question_Group', array('EQG_primary' => 0));
148
+				$success[] = ! empty($qg) ? 1 : 0;
149 149
 			}
150 150
 		}
151 151
 
152 152
 		//wait a minute... are there question groups missing in the saved groups that ARE with the current event?
153
-		$removed_qgs = array_diff( $current_qgs, $added_qgs );
153
+		$removed_qgs = array_diff($current_qgs, $added_qgs);
154 154
 
155
-		foreach ( $removed_qgs as $qgid ) {
156
-			$qg = $evtobj->_remove_relation_to( $qgid, 'Question_Group', array('EQG_primary' => 0 ) );
157
-			$success[] = !empty($qg) ? 1 : 0;
155
+		foreach ($removed_qgs as $qgid) {
156
+			$qg = $evtobj->_remove_relation_to($qgid, 'Question_Group', array('EQG_primary' => 0));
157
+			$success[] = ! empty($qg) ? 1 : 0;
158 158
 		}
159 159
 
160 160
 
Please login to merge, or discard this patch.
registration_form/templates/question_groups_main_meta_box.template.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -9,8 +9,8 @@  discard block
 block discarded – undo
9 9
 assert($question_group);
10 10
 assert($question_group instanceof EE_Question_Group);
11 11
 /* @var EE_Question[] $all_questions */
12
-assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions)));//list of unused questions
13
-foreach($all_questions as $unused_question){
12
+assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions))); //list of unused questions
13
+foreach ($all_questions as $unused_question) {
14 14
 	assert($unused_question);
15 15
 	assert($unused_question instanceof EE_Question);
16 16
 }
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 
20 20
 $QSG_system = $question_group->system_group();
21 21
 
22
-$disabled = ! empty( $QSG_system ) ? ' disabled="disabled"' : '';
23
-$id =  ! empty( $QST_system ) ? '_disabled' : '';
22
+$disabled = ! empty($QSG_system) ? ' disabled="disabled"' : '';
23
+$id = ! empty($QST_system) ? '_disabled' : '';
24 24
 ?>
25 25
 
26 26
 <div id="group-details" class="edit-group padding">
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 			<tr>
31 31
 				<th>
32 32
 					<label for="QSG_name">
33
-						<?php _e('Group Name','event_espresso');?> <?php echo EEH_Template::get_help_tab_link('group_name_info');?>
33
+						<?php _e('Group Name', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('group_name_info'); ?>
34 34
 					</label>
35 35
 				</th>
36 36
 				<td>
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
 			<tr>
43 43
 				<th>
44 44
 					<label for="QSG_identifier">
45
-						<?php _e('Group Identifier','event_espresso');?> <?php echo EEH_Template::get_help_tab_link('group_identifier_info');?>
45
+						<?php _e('Group Identifier', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('group_identifier_info'); ?>
46 46
 					</label>
47 47
 				</th>
48 48
 				<td>
49 49
 					<input id="QSG_identifier" name="QSG_identifier<?php echo $id; ?>" value="<?php echo $question_group->identifier()?>" type="text" class="regular-text"<?php echo $disabled; ?>>
50
-					<?php if ( ! empty( $QSG_system )) { ?>
50
+					<?php if ( ! empty($QSG_system)) { ?>
51 51
 					<p><span class="description" style="color:#D54E21;">
52
-							<?php _e('System question group! This field cannot be changed.','event_espresso')?>
52
+							<?php _e('System question group! This field cannot be changed.', 'event_espresso')?>
53 53
 					</span><br/></p>
54 54
 					<?php } ?>
55 55
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 			<tr>
59 59
 				<th>
60 60
 					<label for="QSG_desc">
61
-						<?php _e('Description','event_espresso');?> <?php echo EEH_Template::get_help_tab_link('group_description_info');?>
61
+						<?php _e('Description', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('group_description_info'); ?>
62 62
 					</label>
63 63
 				</th>
64 64
 				<td>
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 			<tr>
70 70
 				<th>
71 71
 					<label for="QSG_order">
72
-						<?php _e('Question Group Order','event_espresso');?> <?php echo EEH_Template::get_help_tab_link('group_order_info');?>
72
+						<?php _e('Question Group Order', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('group_order_info'); ?>
73 73
 					</label>
74 74
 				</th>
75 75
 				<td>
@@ -80,13 +80,13 @@  discard block
 block discarded – undo
80 80
 			<tr>
81 81
 				<th>
82 82
 					<label>
83
-						<?php _e('Show Name','event_espresso');?> <?php echo EEH_Template::get_help_tab_link('show_group_name_info');?>
83
+						<?php _e('Show Name', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('show_group_name_info'); ?>
84 84
 					</label>
85 85
 				</th>
86 86
 				<td>
87 87
 					<label for="QSG_show_group_name">
88
-                        <?php echo EEH_Form_Fields::select_input( 'QSG_show_group_name', $values, $question_group->show_group_name() ); ?>
89
-						<p class="description"><?php _e('Show Group Name on Registration Page?','event_espresso');?></p>
88
+                        <?php echo EEH_Form_Fields::select_input('QSG_show_group_name', $values, $question_group->show_group_name()); ?>
89
+						<p class="description"><?php _e('Show Group Name on Registration Page?', 'event_espresso'); ?></p>
90 90
 					</label>
91 91
 				</td>
92 92
 			</tr>
@@ -94,13 +94,13 @@  discard block
 block discarded – undo
94 94
 			<tr>
95 95
 				<th>
96 96
 					<label>
97
-						<?php _e(' Show Description','event_espresso');?> <?php echo EEH_Template::get_help_tab_link('show_group_description_info');?>
97
+						<?php _e(' Show Description', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('show_group_description_info'); ?>
98 98
 					</label>
99 99
 				</th>
100 100
 				<td>
101 101
                     <label for="QSG_show_group_order">
102
-                        <?php echo EEH_Form_Fields::select_input( 'QSG_show_group_desc', $values, $question_group->show_group_desc() ); ?>
103
-                        <p class="description"><?php _e(' Show Group Description on Registration Page?','event_espresso');?></p>
102
+                        <?php echo EEH_Form_Fields::select_input('QSG_show_group_desc', $values, $question_group->show_group_desc()); ?>
103
+                        <p class="description"><?php _e(' Show Group Description on Registration Page?', 'event_espresso'); ?></p>
104 104
 					</label>
105 105
                     <input type="hidden" name="QSG_system" value="<?php echo $question_group->system_group(); ?>">
106 106
                 </td>
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 </div>
112 112
 
113 113
 <div id="group-questions" class="edit-group padding question-group-questions-container postbox">
114
-    <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'event_espresso' ); ?>"><br></div>
115
-    <h2 class="handle"><?php _e('Questions','event_espresso');?></h2>
114
+    <div class="handlediv" title="<?php esc_attr_e('Click to toggle', 'event_espresso'); ?>"><br></div>
115
+    <h2 class="handle"><?php _e('Questions', 'event_espresso'); ?></h2>
116 116
 	<div class="form-table question-group-questions inside">
117 117
         <div class="padding">
118 118
             <p><span class="description"><?php _e('Select which questions should be shown in this group by checking or unchecking boxes. You can drag and drop questions to reorder them. Your changes will be updated when you save.', 'event_espresso'); ?></span></p>
@@ -121,26 +121,26 @@  discard block
 block discarded – undo
121 121
                     <?php
122 122
 					$question_order = 0;
123 123
 					$question_group_questions = $question_group->questions();
124
-                    foreach( $all_questions as $question_ID => $question ){
125
-						if ( $question instanceof EE_Question ) {
124
+                    foreach ($all_questions as $question_ID => $question) {
125
+						if ($question instanceof EE_Question) {
126 126
 							/*@var $question EE_Question*/
127
-							$checked = isset( $question_group_questions[ $question_ID ] ) ? ' checked="checked"' : '';
127
+							$checked = isset($question_group_questions[$question_ID]) ? ' checked="checked"' : '';
128 128
 							// disable questions from the personal information question group
129 129
 							// is it required in the current question group? if so don't allow admins to remove it
130
-							$disabled = in_array( $question->system_ID(), EEM_Question::instance()->required_system_questions_in_system_question_group( $QSG_system ) ) ? 'disabled="disabled"' : '';
130
+							$disabled = in_array($question->system_ID(), EEM_Question::instance()->required_system_questions_in_system_question_group($QSG_system)) ? 'disabled="disabled"' : '';
131 131
 							//limit where system questions can appear
132 132
 							if (
133 133
 								$question->system_ID() &&
134
-								! in_array( $question->system_ID(), EEM_Question::instance()->allowed_system_questions_in_system_question_group( $QSG_system ) )
134
+								! in_array($question->system_ID(), EEM_Question::instance()->allowed_system_questions_in_system_question_group($QSG_system))
135 135
 							) {
136 136
 								continue; //skip over system question not assigned to this group except for the address system group cause we want the address questions to display even if they aren't selected (but still not show the personal system questions).  The third condition checks if we're displaying a non system question group and the question is a system question, then we skip because for non-system question groups we only want to show non-system questions.
137 137
 							}
138 138
 						?>
139 139
                     <li class="ee-question-sortable">
140 140
                         <label for="question-<?php echo $question_ID?>">
141
-                            <input type="checkbox" name="questions[<?php echo $question_ID;?>]" id="question-<?php echo $question_ID; ?>" value="<?php echo $question_ID;?>"<?php echo $disabled; ?><?php echo $checked; ?>/>
141
+                            <input type="checkbox" name="questions[<?php echo $question_ID; ?>]" id="question-<?php echo $question_ID; ?>" value="<?php echo $question_ID; ?>"<?php echo $disabled; ?><?php echo $checked; ?>/>
142 142
                             <span class="question-text">
143
-								<?php echo trim( $question->display_text() ) . ( 95 <= strlen( trim( $question->display_text() ) ) ? "&hellip;" : '' ); ?>
143
+								<?php echo trim($question->display_text()).(95 <= strlen(trim($question->display_text())) ? "&hellip;" : ''); ?>
144 144
 							</span>
145 145
                             <input class="question-group-QGQ_order" type="hidden" name="question_orders[<?php echo $question_ID; ?>]" value="<?php echo $question_order; ?>">
146 146
                         </label>
Please login to merge, or discard this patch.
admin/extend/registrations/EE_Event_Registrations_List_Table.class.php 1 patch
Spacing   +80 added lines, -80 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 
18 18
 
19
-	public function __construct( $admin_page ) {
19
+	public function __construct($admin_page) {
20 20
 		parent::__construct($admin_page);
21 21
 		$this->_status = $this->_admin_page->get_registration_status_array();
22 22
 	}
@@ -25,15 +25,15 @@  discard block
 block discarded – undo
25 25
 
26 26
 
27 27
 	protected function _setup_data() {
28
-		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees( $this->_per_page ) : $this->_admin_page->get_event_attendees( $this->_per_page, FALSE, TRUE );
29
-		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees(  $this->_per_page, TRUE ) : $this->_admin_page->get_event_attendees(  $this->_per_page, TRUE, TRUE);
28
+		$this->_data = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page) : $this->_admin_page->get_event_attendees($this->_per_page, FALSE, TRUE);
29
+		$this->_all_data_count = $this->_view != 'trash' ? $this->_admin_page->get_event_attendees($this->_per_page, TRUE) : $this->_admin_page->get_event_attendees($this->_per_page, TRUE, TRUE);
30 30
 	}
31 31
 
32 32
 
33 33
 
34 34
 
35 35
 	protected function _set_properties() {
36
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;
36
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;
37 37
 
38 38
 		$this->_wp_list_args = array(
39 39
 			'singular' => __('registrant', 'event_espresso'),
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 		$columns = array();
46 46
 		//$columns['_Reg_Status'] = '';
47
-		if ( !empty( $evt_id ) ) {
47
+		if ( ! empty($evt_id)) {
48 48
 			$columns['cb'] = '<input type="checkbox" />'; //Render a checkbox instead of text
49 49
 			$this->_has_checkbox_column = true;
50 50
 		}
@@ -60,40 +60,40 @@  discard block
 block discarded – undo
60 60
 				'TXN_total' => __('Total', 'event_espresso')
61 61
 			);
62 62
 
63
-		$this->_columns = array_merge( $columns, $this->_columns);
63
+		$this->_columns = array_merge($columns, $this->_columns);
64 64
 
65 65
 		$this->_primary_column = '_REG_att_checked_in';
66 66
 
67
-		if ( !empty( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id )  ) {
67
+		if ( ! empty($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_read_registrations', 'espresso_registrations_registrations_reports', $evt_id)) {
68 68
 			$this->_bottom_buttons = array(
69 69
 				'report'=> array(
70 70
 					'route' => 'registrations_report',
71
-					'extra_request' => !empty($evt_id) ? array('EVT_ID'=>$evt_id) : NULL
71
+					'extra_request' => ! empty($evt_id) ? array('EVT_ID'=>$evt_id) : NULL
72 72
 				)
73 73
 			);
74 74
 		}
75 75
 
76 76
 		$this->_sortable_columns = array(
77 77
 			 //true means its already sorted
78
-			'ATT_name' => array( 'ATT_name' => TRUE ),
79
-			'Event' => array( 'Event.EVT.Name' => FALSE )
78
+			'ATT_name' => array('ATT_name' => TRUE),
79
+			'Event' => array('Event.EVT.Name' => FALSE)
80 80
 		);
81 81
 
82 82
 		$this->_hidden_columns = array();
83 83
 
84 84
 		$this->_evt = EEM_Event::instance()->get_one_by_ID($evt_id);
85
-		$this->_dtts_for_event = !empty($evt_id) ? $this->_evt->datetimes_ordered() : array();
85
+		$this->_dtts_for_event = ! empty($evt_id) ? $this->_evt->datetimes_ordered() : array();
86 86
 
87 87
 	}
88 88
 
89 89
 
90 90
 
91 91
 
92
-	protected function _get_row_class( $item ) {
93
-		$class = parent::_get_row_class( $item );
92
+	protected function _get_row_class($item) {
93
+		$class = parent::_get_row_class($item);
94 94
 		//add status class
95
-		$class .= ' ee-status-strip reg-status-' . $item->status_ID();
96
-		if ( $this->_has_checkbox_column ) {
95
+		$class .= ' ee-status-strip reg-status-'.$item->status_ID();
96
+		if ($this->_has_checkbox_column) {
97 97
 			$class .= ' has-checkbox-column';
98 98
 		}
99 99
 		return $class;
@@ -104,44 +104,44 @@  discard block
 block discarded – undo
104 104
 	protected function _get_table_filters() {
105 105
 		$filters = $where = array();
106 106
 
107
-		EE_Registry::instance()->load_helper( 'Form_Fields' );
107
+		EE_Registry::instance()->load_helper('Form_Fields');
108 108
 
109
-		if ( empty( $this->_dtts_for_event ) ) {
109
+		if (empty($this->_dtts_for_event)) {
110 110
 			//this means we don't have an event so let's setup a filter dropdown for all the events to select
111 111
 			//note possible capability restrictions
112
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_events', 'get_events') ) {
113
-				$where['status**'] =  array( '!=', 'private' );
112
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_events', 'get_events')) {
113
+				$where['status**'] = array('!=', 'private');
114 114
 			}
115 115
 
116
-			if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_events', 'get_events' ) ) {
117
-				$where['EVT_wp_user'] =  get_current_user_id();
116
+			if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_events', 'get_events')) {
117
+				$where['EVT_wp_user'] = get_current_user_id();
118 118
 			}
119 119
 
120
-			$events = EEM_Event::instance()->get_all(array( $where, 'order_by' => array( 'Datetime.DTT_EVT_start' => 'DESC' ) ) );
121
-			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso') );
122
-			foreach ( $events as $evt ) {
120
+			$events = EEM_Event::instance()->get_all(array($where, 'order_by' => array('Datetime.DTT_EVT_start' => 'DESC')));
121
+			$evts[] = array('id' => 0, 'text' => __('To toggle Check-in status, select an event', 'event_espresso'));
122
+			foreach ($events as $evt) {
123 123
 				//any registrations for this event?
124
-				if ( ! $evt->get_count_of_all_registrations() )
124
+				if ( ! $evt->get_count_of_all_registrations())
125 125
 					continue;
126 126
 				$evts[] = array(
127 127
 					'id' => $evt->ID(),
128
-					'text' => $evt->get( 'EVT_name' ),
128
+					'text' => $evt->get('EVT_name'),
129 129
 					'class' => $evt->is_expired() ? 'ee-expired-event' : ''
130 130
 				);
131 131
 			}
132 132
 			$event_filter = '<div class="ee-event-filter">';
133
-			$event_filter .= EEH_Form_Fields::select_input( 'event_id', $evts );
134
-			$event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>' . ' ' . __( 'Hide Expired Events', 'event_espresso' ) . '</span>';
133
+			$event_filter .= EEH_Form_Fields::select_input('event_id', $evts);
134
+			$event_filter .= '<br><span class="ee-event-filter-toggle"><input type="checkbox" id="js-ee-hide-expired-events" checked>'.' '.__('Hide Expired Events', 'event_espresso').'</span>';
135 135
 			$event_filter .= '</div>';
136 136
 			$filters[] = $event_filter;
137 137
 
138 138
 		} else {
139 139
 			//DTT datetimes filter
140
-			$cur_dtt = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
140
+			$cur_dtt = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : $this->_evt->primary_datetime()->ID();
141 141
 			$dtts = array();
142
-			foreach ( $this->_dtts_for_event as $dtt ) {
143
-				$datetime_string = $dtt->start_date_and_time() . ' - ' . $dtt->end_date_and_time();
144
-				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string );
142
+			foreach ($this->_dtts_for_event as $dtt) {
143
+				$datetime_string = $dtt->start_date_and_time().' - '.$dtt->end_date_and_time();
144
+				$dtts[] = array('id' => $dtt->ID(), 'text' => $datetime_string);
145 145
 			}
146 146
 			$filters[] = EEH_Form_Fields::select_input('DTT_ID', $dtts, $cur_dtt);
147 147
 		}
@@ -162,19 +162,19 @@  discard block
 block discarded – undo
162 162
 
163 163
 
164 164
 	protected function _get_total_event_attendees() {
165
-		$EVT_ID = isset($this->_req_data['event_id']) ? absint( $this->_req_data['event_id'] ) : FALSE;
166
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
165
+		$EVT_ID = isset($this->_req_data['event_id']) ? absint($this->_req_data['event_id']) : FALSE;
166
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
167 167
 		$query_params = array();
168
-		if ($EVT_ID){
169
-			$query_params[0]['EVT_ID']=$EVT_ID;
168
+		if ($EVT_ID) {
169
+			$query_params[0]['EVT_ID'] = $EVT_ID;
170 170
 		}
171 171
 		//if DTT is included we do multiple datetimes.  Otherwise we just do primary datetime
172
-		if ( $DTT_ID ) {
172
+		if ($DTT_ID) {
173 173
 			$query_params[0]['Ticket.Datetime.DTT_ID'] = $DTT_ID;
174 174
 		}
175
-		$status_ids_array = apply_filters( 'FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array( EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved ) );
175
+		$status_ids_array = apply_filters('FHEE__Extend_Registrations_Admin_Page__get_event_attendees__status_ids_array', array(EEM_Registration::status_id_pending_payment, EEM_Registration::status_id_approved));
176 176
 
177
-		$query_params[0]['STS_ID']= array('IN', $status_ids_array );
177
+		$query_params[0]['STS_ID'] = array('IN', $status_ids_array);
178 178
 
179 179
 		return EEM_Registration::instance()->count($query_params);
180 180
 	}
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 
186 186
 
187 187
 
188
-	function column__Reg_Status( EE_Registration $item ) {
189
-		return '<span class="ee-status-strip ee-status-strip-td reg-status-' . $item->status_ID() . '"></span>';
188
+	function column__Reg_Status(EE_Registration $item) {
189
+		return '<span class="ee-status-strip ee-status-strip-td reg-status-'.$item->status_ID().'"></span>';
190 190
 	}
191 191
 
192 192
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 
195 195
 
196 196
 	function column_cb($item) {
197
-		return sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID() );
197
+		return sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', $item->ID());
198 198
 	}
199 199
 
200 200
 
@@ -207,18 +207,18 @@  discard block
 block discarded – undo
207 207
 	/**
208 208
 	 * 		column_REG_att_checked_in
209 209
 	*/
210
-	function column__REG_att_checked_in(EE_Registration $item){
210
+	function column__REG_att_checked_in(EE_Registration $item) {
211 211
 		$attendee = $item->attendee();
212 212
 		$attendee_name = $attendee instanceof EE_Attendee ? $attendee->full_name() : '';
213
-		$DTT_ID = isset( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : 0;
213
+		$DTT_ID = isset($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : 0;
214 214
 		$checkinstatus = $item->check_in_status_for_datetime($DTT_ID);
215 215
 		$nonce = wp_create_nonce('checkin_nonce');
216
-		$evt_id = isset( $this->_req_data['event_id'] ) ? $this->_req_data['event_id'] : NULL;
217
-		$toggle_active = !empty ( $evt_id ) && EE_Registry::instance()->CAP->current_user_can( 'ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID() ) ? ' clickable trigger-checkin' : '';
216
+		$evt_id = isset($this->_req_data['event_id']) ? $this->_req_data['event_id'] : NULL;
217
+		$toggle_active = ! empty ($evt_id) && EE_Registry::instance()->CAP->current_user_can('ee_edit_checkin', 'espresso_registrations_toggle_checkin_status', $item->ID()) ? ' clickable trigger-checkin' : '';
218 218
 
219
-		$mobile_view_content = ' <span class="show-on-mobile-view-only">' . $attendee_name . '</span>';
219
+		$mobile_view_content = ' <span class="show-on-mobile-view-only">'.$attendee_name.'</span>';
220 220
 
221
-		 return '<span class="checkin-icons checkedin-status-' . $checkinstatus . $toggle_active . '" data-_regid="' . $item->ID() . '" data-dttid="' . $DTT_ID . '" data-nonce="' . $nonce . '"></span>' . $mobile_view_content;
221
+		 return '<span class="checkin-icons checkedin-status-'.$checkinstatus.$toggle_active.'" data-_regid="'.$item->ID().'" data-dttid="'.$DTT_ID.'" data-nonce="'.$nonce.'"></span>'.$mobile_view_content;
222 222
 	}
223 223
 
224 224
 
@@ -227,43 +227,43 @@  discard block
 block discarded – undo
227 227
 
228 228
 	function column_ATT_name(EE_Registration $item) {
229 229
 		$attendee = $item->attendee();
230
-		if ( ! $attendee instanceof EE_Attendee ) {
230
+		if ( ! $attendee instanceof EE_Attendee) {
231 231
 			return __('No contact record for this registration.', 'event_espresso');
232 232
 		}
233 233
 
234 234
 		// edit attendee link
235
-		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$item->ID() ), REG_ADMIN_URL );
236
-		$name_link = EE_Registry::instance()->CAP->current_user_can( 'ee_edit_contacts', 'espresso_registrations_edit_attendee' ) ?  '<a href="'.$edit_lnk_url.'" title="' . esc_attr__( 'Edit Contact', 'event_espresso' ) . '">' . $item->attendee()->full_name() . '</a>' : $item->attendee()->full_name();
235
+		$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$item->ID()), REG_ADMIN_URL);
236
+		$name_link = EE_Registry::instance()->CAP->current_user_can('ee_edit_contacts', 'espresso_registrations_edit_attendee') ? '<a href="'.$edit_lnk_url.'" title="'.esc_attr__('Edit Contact', 'event_espresso').'">'.$item->attendee()->full_name().'</a>' : $item->attendee()->full_name();
237 237
 		$name_link .= $item->count() == 1 ? '&nbsp;<sup><div class="dashicons dashicons-star-filled lt-blue-icon ee-icon-size-8"></div></sup>	' : '';
238 238
 
239 239
 		//add group details
240
-		$name_link .= '&nbsp;' . sprintf(__( '(%s of %s)', 'event_espresso' ),$item->count(), $item->group_size());
240
+		$name_link .= '&nbsp;'.sprintf(__('(%s of %s)', 'event_espresso'), $item->count(), $item->group_size());
241 241
 
242 242
 		//add regcode
243
-		$link = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'view_registration', '_REG_ID' => $item->ID() ), REG_ADMIN_URL );
243
+		$link = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'view_registration', '_REG_ID' => $item->ID()), REG_ADMIN_URL);
244 244
 		$name_link .= '<br>';
245
-		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID() )
246
-			? '<a href="' . $link . '" title="' . esc_attr__('View Registration Details', 'event_espresso') .'">' . $item->reg_code() . '</a>'
245
+		$name_link .= EE_Registry::instance()->instance()->CAP->current_user_can('ee_read_registration', 'view_registration', $item->ID())
246
+			? '<a href="'.$link.'" title="'.esc_attr__('View Registration Details', 'event_espresso').'">'.$item->reg_code().'</a>'
247 247
 			: $item->reg_code();
248 248
 
249 249
 		//status
250
-		$name_link .= '<br><span class="ee-status-text-small">' . EEH_Template::pretty_status( $item->status_ID(), false, 'sentence' ) . '</span>';
250
+		$name_link .= '<br><span class="ee-status-text-small">'.EEH_Template::pretty_status($item->status_ID(), false, 'sentence').'</span>';
251 251
 
252 252
 		$actions = array();
253
-		$DTT_ID = !empty( $this->_req_data['DTT_ID'] ) ? $this->_req_data['DTT_ID'] : NULL;
254
-		$DTT_ID = empty( $DTT_ID ) && !empty( $this->_req_data['event_id'] ) ? EEM_Event::instance()->get_one_by_ID( $this->_req_data['event_id'] )->primary_datetime()->ID() : $DTT_ID;
253
+		$DTT_ID = ! empty($this->_req_data['DTT_ID']) ? $this->_req_data['DTT_ID'] : NULL;
254
+		$DTT_ID = empty($DTT_ID) && ! empty($this->_req_data['event_id']) ? EEM_Event::instance()->get_one_by_ID($this->_req_data['event_id'])->primary_datetime()->ID() : $DTT_ID;
255 255
 
256
-		if ( !empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ) {
257
-			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce( array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
258
-			$actions['checkin'] = '<a href="' . $checkin_list_url . '" title="' . esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso' ) . '">' . __('View', 'event_espresso') . '</a>';
256
+		if ( ! empty($DTT_ID) && EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins')) {
257
+			$checkin_list_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'registration_checkins', '_REGID' => $item->ID(), 'DTT_ID' => $DTT_ID));
258
+			$actions['checkin'] = '<a href="'.$checkin_list_url.'" title="'.esc_attr__('View all the check-ins/checkouts for this registrant', 'event_espresso').'">'.__('View', 'event_espresso').'</a>';
259 259
 		}
260 260
 
261
-		return !empty( $DTT_ID ) ? sprintf( '%1$s %2$s', $name_link, $this->row_actions($actions) ) : $name_link;
261
+		return ! empty($DTT_ID) ? sprintf('%1$s %2$s', $name_link, $this->row_actions($actions)) : $name_link;
262 262
 	}
263 263
 
264 264
 
265 265
 
266
-	function column_ATT_email( EE_Registration $item ) {
266
+	function column_ATT_email(EE_Registration $item) {
267 267
 		$attendee = $item->attendee();
268 268
 		return $attendee instanceof EE_Attendee ? $attendee->email() : '';
269 269
 		return $item->get_first_related('Attendee')->email();
@@ -275,8 +275,8 @@  discard block
 block discarded – undo
275 275
 
276 276
 	function column_Event(EE_Registration $item) {
277 277
 		$event = $this->_evt instanceof EE_Event ? $this->_evt : $item->event();
278
-		$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'event_registrations', 'event_id'=>$event->ID() ), REG_ADMIN_URL );
279
-		$event_label = EE_Registry::instance()->CAP->current_user_can( 'ee_read_checkins', 'espresso_registrations_registration_checkins' ) ?  '<a href="'.$chkin_lnk_url.'" title="' . esc_attr__( 'View Checkins for this Event', 'event_espresso' ) . '">' . $event->name() . '</a>' : $event->name();
278
+		$chkin_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'event_registrations', 'event_id'=>$event->ID()), REG_ADMIN_URL);
279
+		$event_label = EE_Registry::instance()->CAP->current_user_can('ee_read_checkins', 'espresso_registrations_registration_checkins') ? '<a href="'.$chkin_lnk_url.'" title="'.esc_attr__('View Checkins for this Event', 'event_espresso').'">'.$event->name().'</a>' : $event->name();
280 280
 		return $event_label;
281 281
 	}
282 282
 
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 
285 285
 
286 286
 
287
-	function column_PRC_name(EE_Registration $item){
287
+	function column_PRC_name(EE_Registration $item) {
288 288
 		return $item->ticket() instanceof EE_Ticket ? $item->ticket()->name() : __("Unknown", "event_espresso");
289 289
 	}
290 290
 
@@ -296,8 +296,8 @@  discard block
 block discarded – undo
296 296
 	/**
297 297
 	 * 		column_REG_final_price
298 298
 	*/
299
-	function column__REG_final_price(EE_Registration $item){
300
-		return '<span class="reg-pad-rght">' .  ' ' . $item->pretty_final_price() . '</span>';
299
+	function column__REG_final_price(EE_Registration $item) {
300
+		return '<span class="reg-pad-rght">'.' '.$item->pretty_final_price().'</span>';
301 301
 	}
302 302
 
303 303
 
@@ -307,20 +307,20 @@  discard block
 block discarded – undo
307 307
 	/**
308 308
 	 * 		column_TXN_paid
309 309
 	*/
310
-	function column_TXN_paid(EE_Registration $item){
310
+	function column_TXN_paid(EE_Registration $item) {
311 311
 
312
-		if ( $item->count() == 1 ) {
312
+		if ($item->count() == 1) {
313 313
 
314
-			if ( $item->transaction()->paid() >= $item->transaction()->total() ) {
314
+			if ($item->transaction()->paid() >= $item->transaction()->total()) {
315 315
 				return '<span class="reg-pad-rght"><div class="dashicons dashicons-yes green-icon"></div></span>';
316 316
 			} else {
317
-				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID() ), TXN_ADMIN_URL );
318
-				return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '
317
+				$view_txn_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_transaction', 'TXN_ID'=>$item->transaction_ID()), TXN_ADMIN_URL);
318
+				return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '
319 319
 				<span class="reg-pad-rght">
320
-					<a class="status-'. $item->transaction()->status_ID() .'" href="'.$view_txn_lnk_url.'"  title="' . esc_attr__( 'View Transaction', 'event_espresso' ) . '">
321
-						' . $item->transaction()->pretty_paid(). '
320
+					<a class="status-'. $item->transaction()->status_ID().'" href="'.$view_txn_lnk_url.'"  title="'.esc_attr__('View Transaction', 'event_espresso').'">
321
+						' . $item->transaction()->pretty_paid().'
322 322
 					</a>
323
-				<span>' : '<span class="reg-pad-rght">' . $item->transaction()->pretty_paid() . '</span>';
323
+				<span>' : '<span class="reg-pad-rght">'.$item->transaction()->pretty_paid().'</span>';
324 324
 			}
325 325
 		} else {
326 326
 			return '<span class="reg-pad-rght"></span>';
@@ -334,13 +334,13 @@  discard block
 block discarded – undo
334 334
 	/**
335 335
 	 * 		column_TXN_total
336 336
 	*/
337
-	function column_TXN_total(EE_Registration $item){
337
+	function column_TXN_total(EE_Registration $item) {
338 338
 		$txn = $item->transaction();
339
-		$view_txn_url = add_query_arg( array('action' => 'view_transaction', 'TXN_ID' => $txn->ID() ), TXN_ADMIN_URL );
340
-		if ( $item->get('REG_count') == 1 ) {
339
+		$view_txn_url = add_query_arg(array('action' => 'view_transaction', 'TXN_ID' => $txn->ID()), TXN_ADMIN_URL);
340
+		if ($item->get('REG_count') == 1) {
341 341
 			$line_total_obj = $txn->total_line_item();
342 342
 			$txn_total = $line_total_obj instanceof EE_Line_Item ? $line_total_obj->get_pretty('LIN_total') : __('View Transaction', 'event_espresso');
343
-			return EE_Registry::instance()->CAP->current_user_can( 'ee_read_transaction', 'espresso_transactions_view_transaction' ) ?  '<a href="' . $view_txn_url . '" title="' . esc_attr__('View Transaction', 'event_espresso') . '"><span class="reg-pad-rght">'. $txn_total  .'</span></a>' : '<span class="reg-pad-rght">' . $txn_total . '</span>';
343
+			return EE_Registry::instance()->CAP->current_user_can('ee_read_transaction', 'espresso_transactions_view_transaction') ? '<a href="'.$view_txn_url.'" title="'.esc_attr__('View Transaction', 'event_espresso').'"><span class="reg-pad-rght">'.$txn_total.'</span></a>' : '<span class="reg-pad-rght">'.$txn_total.'</span>';
344 344
 		} else {
345 345
 			return '<span class="reg-pad-rght"></span>';
346 346
 		}
Please login to merge, or discard this patch.