@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.10.5.rc.001'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.10.5.rc.001'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | /* @var EE_Question[] $all_questions */ |
12 | 12 | assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions)));// list of unused questions |
13 | 13 | foreach ($all_questions as $unused_question) { |
14 | - assert($unused_question); |
|
15 | - assert($unused_question instanceof EE_Question); |
|
14 | + assert($unused_question); |
|
15 | + assert($unused_question instanceof EE_Question); |
|
16 | 16 | } |
17 | 17 | /* @var array $values . Array of arrays, where each sub-array contains 2 keys: 'id' (internal value) and 'name' (label for displaying) */ |
18 | 18 | assert(is_array($values)); |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | <th> |
32 | 32 | <label for="QSG_name"> |
33 | 33 | <?php _e('Group Name', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
34 | - 'group_name_info' |
|
35 | - ); ?> |
|
34 | + 'group_name_info' |
|
35 | + ); ?> |
|
36 | 36 | </label> |
37 | 37 | </th> |
38 | 38 | <td> |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | <th> |
47 | 47 | <label for="QSG_identifier"> |
48 | 48 | <?php _e('Group Identifier', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
49 | - 'group_identifier_info' |
|
50 | - ); ?> |
|
49 | + 'group_identifier_info' |
|
50 | + ); ?> |
|
51 | 51 | </label> |
52 | 52 | </th> |
53 | 53 | <td> |
@@ -66,8 +66,8 @@ discard block |
||
66 | 66 | <th> |
67 | 67 | <label for="QSG_desc"> |
68 | 68 | <?php _e('Description', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
69 | - 'group_description_info' |
|
70 | - ); ?> |
|
69 | + 'group_description_info' |
|
70 | + ); ?> |
|
71 | 71 | </label> |
72 | 72 | </th> |
73 | 73 | <td> |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | <th> |
81 | 81 | <label for="QSG_order"> |
82 | 82 | <?php _e('Question Group Order', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
83 | - 'group_order_info' |
|
84 | - ); ?> |
|
83 | + 'group_order_info' |
|
84 | + ); ?> |
|
85 | 85 | </label> |
86 | 86 | </th> |
87 | 87 | <td> |
@@ -94,17 +94,17 @@ discard block |
||
94 | 94 | <th> |
95 | 95 | <label> |
96 | 96 | <?php _e('Show Name', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
97 | - 'show_group_name_info' |
|
98 | - ); ?> |
|
97 | + 'show_group_name_info' |
|
98 | + ); ?> |
|
99 | 99 | </label> |
100 | 100 | </th> |
101 | 101 | <td> |
102 | 102 | <label for="QSG_show_group_name"> |
103 | 103 | <?php echo EEH_Form_Fields::select_input( |
104 | - 'QSG_show_group_name', |
|
105 | - $values, |
|
106 | - $question_group->show_group_name() |
|
107 | - ); ?> |
|
104 | + 'QSG_show_group_name', |
|
105 | + $values, |
|
106 | + $question_group->show_group_name() |
|
107 | + ); ?> |
|
108 | 108 | <p class="description"><?php _e('Show Group Name on Registration Page?', 'event_espresso'); ?></p> |
109 | 109 | </label> |
110 | 110 | </td> |
@@ -114,20 +114,20 @@ discard block |
||
114 | 114 | <th> |
115 | 115 | <label> |
116 | 116 | <?php _e(' Show Description', 'event_espresso'); ?><?php echo EEH_Template::get_help_tab_link( |
117 | - 'show_group_description_info' |
|
118 | - ); ?> |
|
117 | + 'show_group_description_info' |
|
118 | + ); ?> |
|
119 | 119 | </label> |
120 | 120 | </th> |
121 | 121 | <td> |
122 | 122 | <label for="QSG_show_group_order"> |
123 | 123 | <?php echo EEH_Form_Fields::select_input( |
124 | - 'QSG_show_group_desc', |
|
125 | - $values, |
|
126 | - $question_group->show_group_desc() |
|
127 | - ); ?> |
|
124 | + 'QSG_show_group_desc', |
|
125 | + $values, |
|
126 | + $question_group->show_group_desc() |
|
127 | + ); ?> |
|
128 | 128 | <p class="description"><?php |
129 | - _e(' Show Group Description on Registration Page?', 'event_espresso'); |
|
130 | - ?></p> |
|
129 | + _e(' Show Group Description on Registration Page?', 'event_espresso'); |
|
130 | + ?></p> |
|
131 | 131 | </label> |
132 | 132 | <input type="hidden" name="QSG_system" value="<?php echo $question_group->system_group(); ?>"> |
133 | 133 | </td> |
@@ -143,82 +143,82 @@ discard block |
||
143 | 143 | <div class="form-table question-group-questions inside"> |
144 | 144 | <div class="padding"> |
145 | 145 | <p><span class="description"><?php |
146 | - _e( |
|
147 | - '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.', |
|
148 | - 'event_espresso' |
|
149 | - ); ?></span></p> |
|
146 | + _e( |
|
147 | + '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.', |
|
148 | + 'event_espresso' |
|
149 | + ); ?></span></p> |
|
150 | 150 | <div> |
151 | 151 | <ul class="question-list-sortable"> |
152 | 152 | <?php |
153 | - $question_order = 0; |
|
154 | - $question_group_questions = $question_group->questions(); |
|
155 | - foreach ($all_questions as $question_ID => $question) { |
|
156 | - if ($question instanceof EE_Question) { |
|
157 | - /*@var $question EE_Question*/ |
|
158 | - $checked = isset($question_group_questions[ $question_ID ]) ? ' checked="checked"' : ''; |
|
159 | - // disable questions from the personal information question group |
|
160 | - // is it required in the current question group? if so don't allow admins to remove it |
|
161 | - $disabled = in_array( |
|
162 | - $question->system_ID(), |
|
163 | - EEM_Question::instance()->required_system_questions_in_system_question_group( |
|
164 | - $QSG_system |
|
165 | - ) |
|
166 | - ) ? 'disabled="disabled"' : ''; |
|
167 | - // limit where system questions can appear |
|
168 | - if ($question->system_ID() && |
|
169 | - ! in_array( |
|
170 | - $question->system_ID(), |
|
171 | - EEM_Question::instance()->allowed_system_questions_in_system_question_group( |
|
172 | - $QSG_system |
|
173 | - ) |
|
174 | - ) |
|
175 | - ) { |
|
176 | - 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. |
|
177 | - } |
|
178 | - ?> |
|
153 | + $question_order = 0; |
|
154 | + $question_group_questions = $question_group->questions(); |
|
155 | + foreach ($all_questions as $question_ID => $question) { |
|
156 | + if ($question instanceof EE_Question) { |
|
157 | + /*@var $question EE_Question*/ |
|
158 | + $checked = isset($question_group_questions[ $question_ID ]) ? ' checked="checked"' : ''; |
|
159 | + // disable questions from the personal information question group |
|
160 | + // is it required in the current question group? if so don't allow admins to remove it |
|
161 | + $disabled = in_array( |
|
162 | + $question->system_ID(), |
|
163 | + EEM_Question::instance()->required_system_questions_in_system_question_group( |
|
164 | + $QSG_system |
|
165 | + ) |
|
166 | + ) ? 'disabled="disabled"' : ''; |
|
167 | + // limit where system questions can appear |
|
168 | + if ($question->system_ID() && |
|
169 | + ! in_array( |
|
170 | + $question->system_ID(), |
|
171 | + EEM_Question::instance()->allowed_system_questions_in_system_question_group( |
|
172 | + $QSG_system |
|
173 | + ) |
|
174 | + ) |
|
175 | + ) { |
|
176 | + 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. |
|
177 | + } |
|
178 | + ?> |
|
179 | 179 | <li class="ee-question-sortable"> |
180 | 180 | <label for="question-<?php echo $question_ID ?>"> |
181 | 181 | <input type="checkbox" name="questions[<?php echo $question_ID; ?>]" |
182 | 182 | id="question-<?php echo $question_ID; ?>" |
183 | 183 | value="<?php echo $question_ID; ?>"<?php echo $disabled; ?><?php echo $checked; ?>/> |
184 | 184 | <span class="question-text"><?php |
185 | - echo trim($question->display_text()) |
|
186 | - . (95 <= strlen(trim($question->display_text())) |
|
187 | - ? "…" |
|
188 | - : ''); |
|
189 | - ?> |
|
185 | + echo trim($question->display_text()) |
|
186 | + . (95 <= strlen(trim($question->display_text())) |
|
187 | + ? "…" |
|
188 | + : ''); |
|
189 | + ?> |
|
190 | 190 | </span> |
191 | 191 | <input class="question-group-QGQ_order" type="hidden" |
192 | 192 | name="question_orders[<?php echo $question_ID; ?>]" |
193 | 193 | value="<?php echo $question_order; ?>"> |
194 | 194 | </label> |
195 | 195 | <?php |
196 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
197 | - 'ee_edit_question', |
|
198 | - 'espresso_registration_form_edit_question', |
|
199 | - $question->ID() |
|
200 | - )) { |
|
201 | - $edit_query_args = array( |
|
202 | - 'action' => 'edit_question', |
|
203 | - 'QST_ID' => $question->ID(), |
|
204 | - ); |
|
205 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
196 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
197 | + 'ee_edit_question', |
|
198 | + 'espresso_registration_form_edit_question', |
|
199 | + $question->ID() |
|
200 | + )) { |
|
201 | + $edit_query_args = array( |
|
202 | + 'action' => 'edit_question', |
|
203 | + 'QST_ID' => $question->ID(), |
|
204 | + ); |
|
205 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
206 | 206 | |
207 | - echo '<a href="' . $edit_link . '" target="_blank" title="' . |
|
208 | - sprintf( |
|
209 | - esc_attr__('Edit %s', 'event_espresso'), |
|
210 | - $question->admin_label() |
|
211 | - ) |
|
212 | - . '"><span class="dashicons dashicons-edit"></span> |
|
207 | + echo '<a href="' . $edit_link . '" target="_blank" title="' . |
|
208 | + sprintf( |
|
209 | + esc_attr__('Edit %s', 'event_espresso'), |
|
210 | + $question->admin_label() |
|
211 | + ) |
|
212 | + . '"><span class="dashicons dashicons-edit"></span> |
|
213 | 213 | </a>'; |
214 | - } |
|
215 | - ?> |
|
214 | + } |
|
215 | + ?> |
|
216 | 216 | </li> |
217 | 217 | <?php |
218 | - $question_order++; |
|
219 | - } |
|
220 | - } |
|
221 | - ?> |
|
218 | + $question_order++; |
|
219 | + } |
|
220 | + } |
|
221 | + ?> |
|
222 | 222 | </ul> |
223 | 223 | </div> |
224 | 224 | </div> |
@@ -9,7 +9,7 @@ discard block |
||
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 |
|
12 | +assert(isset($all_questions) && (empty($all_questions) || is_array($all_questions))); // list of unused questions |
|
13 | 13 | foreach ($all_questions as $unused_question) { |
14 | 14 | assert($unused_question); |
15 | 15 | assert($unused_question instanceof EE_Question); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | <input id="QSG_identifier" name="QSG_identifier<?php echo $id; ?>" |
55 | 55 | value="<?php $question_group->f('QSG_identifier') ?>" type="text" |
56 | 56 | class="regular-text"<?php echo $disabled; ?>> |
57 | - <?php if (! empty($QSG_system)) { ?> |
|
57 | + <?php if ( ! empty($QSG_system)) { ?> |
|
58 | 58 | <p><span class="description" style="color:#D54E21;"> |
59 | 59 | <?php _e('System question group! This field cannot be changed.', 'event_espresso') ?> |
60 | 60 | </span><br/></p> |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | foreach ($all_questions as $question_ID => $question) { |
156 | 156 | if ($question instanceof EE_Question) { |
157 | 157 | /*@var $question EE_Question*/ |
158 | - $checked = isset($question_group_questions[ $question_ID ]) ? ' checked="checked"' : ''; |
|
158 | + $checked = isset($question_group_questions[$question_ID]) ? ' checked="checked"' : ''; |
|
159 | 159 | // disable questions from the personal information question group |
160 | 160 | // is it required in the current question group? if so don't allow admins to remove it |
161 | 161 | $disabled = in_array( |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | ); |
205 | 205 | $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
206 | 206 | |
207 | - echo '<a href="' . $edit_link . '" target="_blank" title="' . |
|
207 | + echo '<a href="'.$edit_link.'" target="_blank" title="'. |
|
208 | 208 | sprintf( |
209 | 209 | esc_attr__('Edit %s', 'event_espresso'), |
210 | 210 | $question->admin_label() |