@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @access public |
44 | 44 | * @param \EEI_Request_Decorator $request_stack |
45 | 45 | */ |
46 | - public function __construct( EEI_Request_Decorator $request_stack ) { |
|
46 | + public function __construct(EEI_Request_Decorator $request_stack) { |
|
47 | 47 | $this->_request_stack = $request_stack; |
48 | 48 | } |
49 | 49 | |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | * @param EE_Response $response |
58 | 58 | * @return EE_Response |
59 | 59 | */ |
60 | - protected function process_request_stack( EE_Request $request, EE_Response $response ) { |
|
60 | + protected function process_request_stack(EE_Request $request, EE_Response $response) { |
|
61 | 61 | $this->_request = $request; |
62 | 62 | $this->_response = $response; |
63 | - if ( ! $this->_response->request_terminated() ) { |
|
64 | - $this->_response = $this->_request_stack->handle_request( $this->_request, $this->_response ); |
|
63 | + if ( ! $this->_response->request_terminated()) { |
|
64 | + $this->_response = $this->_request_stack->handle_request($this->_request, $this->_response); |
|
65 | 65 | } |
66 | 66 | return $this->_response; |
67 | 67 | } |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | * @param EE_Response $response |
22 | 22 | * @return EE_Response |
23 | 23 | */ |
24 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
24 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
25 | 25 | $this->_request = $request; |
26 | 26 | $this->_response = $response; |
27 | 27 | $this->display_alpha_banner_warning(); |
28 | - $this->_response = $this->process_request_stack( $this->_request, $this->_response ); |
|
28 | + $this->_response = $this->process_request_stack($this->_request, $this->_response); |
|
29 | 29 | return $this->_response; |
30 | 30 | } |
31 | 31 | |
@@ -41,22 +41,22 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function display_alpha_banner_warning() { |
43 | 43 | // skip AJAX requests |
44 | - if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) { |
|
44 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
45 | 45 | return; |
46 | 46 | } |
47 | 47 | // skip stable releases |
48 | - if ( strpos( EVENT_ESPRESSO_VERSION, '.alpha' ) === false ) { |
|
48 | + if (strpos(EVENT_ESPRESSO_VERSION, '.alpha') === false) { |
|
49 | 49 | return; |
50 | 50 | } |
51 | 51 | // post release candidate warning |
52 | - if ( is_admin() ) { |
|
53 | - add_action( 'admin_notices', array( $this, 'alpha_banner_admin_notice' ), -999 ); |
|
52 | + if (is_admin()) { |
|
53 | + add_action('admin_notices', array($this, 'alpha_banner_admin_notice'), -999); |
|
54 | 54 | } else { |
55 | 55 | // site admin has authorized use of non-stable release candidate for production |
56 | - if ( defined( 'ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE' ) && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE ) { |
|
56 | + if (defined('ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE') && ALLOW_NON_STABLE_RELEASE_ON_LIVE_SITE) { |
|
57 | 57 | return; |
58 | 58 | } |
59 | - add_action( 'shutdown', array( $this, 'alpha_banner_warning_notice' ), 10 ); |
|
59 | + add_action('shutdown', array($this, 'alpha_banner_warning_notice'), 10); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | public function alpha_banner_admin_notice() { |
73 | 73 | EE_Error::add_attention( |
74 | 74 | sprintf( |
75 | - __( 'This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso' ), |
|
75 | + __('This version of Event Espresso is for testing and/or evaluation purposes only. It is %1$snot%2$s considered a stable release and should therefore %1$snot%2$s be activated on a live or production website.', 'event_espresso'), |
|
76 | 76 | '<strong>', |
77 | 77 | '</strong>' |
78 | 78 | ), |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | */ |
92 | 92 | public function alpha_banner_warning_notice() { |
93 | 93 | printf( |
94 | - __( '%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso' ), |
|
94 | + __('%1$sThis version of Event Espresso is for testing and/or evaluation purposes only. It is %2$snot%3$s considered a stable release and should therefore %2$snot%3$s be activated on a live or production website.%4$s', 'event_espresso'), |
|
95 | 95 | '<div id="ee-release-candidate-notice-dv" class="ee-really-important-notice-dv"><p>', |
96 | 96 | '<strong>', |
97 | 97 | '</strong>', |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param EEI_Request_Decorator $application |
44 | 44 | * @param array $middlewares |
45 | 45 | */ |
46 | - public function __construct( EEI_Request_Decorator $application, $middlewares = array() ) { |
|
46 | + public function __construct(EEI_Request_Decorator $application, $middlewares = array()) { |
|
47 | 47 | $this->_application = $application; |
48 | 48 | $this->_middlewares = $middlewares; |
49 | 49 | } |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * @param EE_Response $response |
56 | 56 | * @return EE_Response |
57 | 57 | */ |
58 | - public function handle_request( EE_Request $request, EE_Response $response ) { |
|
58 | + public function handle_request(EE_Request $request, EE_Response $response) { |
|
59 | 59 | $this->_request = $request; |
60 | 60 | $this->_response = $response; |
61 | - return $this->_application->handle_request( $request, $response ); |
|
61 | + return $this->_application->handle_request($request, $response); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * after the request stack has been fully processed |
70 | 70 | */ |
71 | 71 | public function handle_response() { |
72 | - foreach ( $this->_middlewares as $middleware ) { |
|
73 | - if ( $middleware instanceof EEI_Request_Stack_Core_App ) { |
|
74 | - $middleware->handle_response( $this->_request, $this->_response ); |
|
72 | + foreach ($this->_middlewares as $middleware) { |
|
73 | + if ($middleware instanceof EEI_Request_Stack_Core_App) { |
|
74 | + $middleware->handle_response($this->_request, $this->_response); |
|
75 | 75 | // exit loop since we should be done |
76 | 76 | // (also in case someone has accidentally labeled multiple apps as the EEI_Request_Stack_Core_App ) |
77 | 77 | break; |
@@ -1,25 +1,25 @@ |
||
1 | 1 | <div class="changelog point-releases"> |
2 | - <!-- <h3><?php echo _n( 'Minor Release Information', 'Minor Releases', 1 ); ?></h3> --> |
|
3 | - <h3><?php echo _n( 'Major Release Information', 'Major Releases', 1 ); ?></h3> |
|
2 | + <!-- <h3><?php echo _n('Minor Release Information', 'Minor Releases', 1); ?></h3> --> |
|
3 | + <h3><?php echo _n('Major Release Information', 'Major Releases', 1); ?></h3> |
|
4 | 4 | <?php //$type = 'minor'; ?> |
5 | 5 | <?php $type = 'major'; ?> |
6 | - <p><?php printf( __( '<strong>Version %1$s</strong> is a %2$s release.', 'event_espresso'), EVENT_ESPRESSO_VERSION, $type ); ?> |
|
6 | + <p><?php printf(__('<strong>Version %1$s</strong> is a %2$s release.', 'event_espresso'), EVENT_ESPRESSO_VERSION, $type); ?> |
|
7 | 7 | <?php |
8 | - $ver = explode( '.', EVENT_ESPRESSO_VERSION ); |
|
9 | - array_pop( $ver ); |
|
10 | - $ver = implode( '.', $ver ); |
|
8 | + $ver = explode('.', EVENT_ESPRESSO_VERSION); |
|
9 | + array_pop($ver); |
|
10 | + $ver = implode('.', $ver); |
|
11 | 11 | ?> |
12 | - <?php printf( __( 'For more information, see <a href="%s" target="_blank">the release notes</a>.' ), 'http://eventespresso.com/wiki/ee4-changelog/#' . $ver ); ?> |
|
12 | + <?php printf(__('For more information, see <a href="%s" target="_blank">the release notes</a>.'), 'http://eventespresso.com/wiki/ee4-changelog/#'.$ver); ?> |
|
13 | 13 | </p> |
14 | 14 | </div> |
15 | 15 | |
16 | 16 | <div class="changelog"> |
17 | 17 | <?php |
18 | 18 | //maintenance mode on? |
19 | - if ( EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance ) { |
|
19 | + if (EE_Maintenance_Mode::instance()->level() == EE_Maintenance_Mode::level_2_complete_maintenance) { |
|
20 | 20 | ?> |
21 | 21 | <div class="ee-attention"> |
22 | - <h2 class="ee-maintenance-mode-callout"><?php _e('Event Espresso is in full maintenance mode.' , 'event_espresso'); ?></h2> |
|
22 | + <h2 class="ee-maintenance-mode-callout"><?php _e('Event Espresso is in full maintenance mode.', 'event_espresso'); ?></h2> |
|
23 | 23 | <p> |
24 | 24 | <?php |
25 | 25 | printf( |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | |
17 | 17 | use EventEspressoBatchRequest\Helpers\BatchRequestException; |
18 | 18 | |
19 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
20 | - exit( 'No direct script access allowed' ); |
|
19 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
20 | + exit('No direct script access allowed'); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @param \EEHI_File|null $file_helper |
41 | 41 | */ |
42 | - public function __construct( \EEHI_File $file_helper = null ) { |
|
43 | - if( ! $file_helper ) { |
|
42 | + public function __construct(\EEHI_File $file_helper = null) { |
|
43 | + if ( ! $file_helper) { |
|
44 | 44 | $this->_file_helper = new \EEH_File(); |
45 | 45 | } |
46 | 46 | } |
@@ -56,39 +56,39 @@ discard block |
||
56 | 56 | * @return string |
57 | 57 | * @throws \EventEspressoBatchRequest\Helpers\BatchRequestException |
58 | 58 | */ |
59 | - public function create_file_from_job_with_name( $job_id, $filename, $filetype = 'application/ms-excel' ) { |
|
59 | + public function create_file_from_job_with_name($job_id, $filename, $filetype = 'application/ms-excel') { |
|
60 | 60 | $filepath = ''; |
61 | - try{ |
|
61 | + try { |
|
62 | 62 | $base_folder = $this->get_base_folder(); |
63 | 63 | $success = $this->_file_helper->ensure_folder_exists_and_is_writable( |
64 | - $base_folder . JobHandlerFile::temp_folder_name |
|
64 | + $base_folder.JobHandlerFile::temp_folder_name |
|
65 | 65 | ); |
66 | - if ( $success ) { |
|
66 | + if ($success) { |
|
67 | 67 | $success = $this->_file_helper->ensure_folder_exists_and_is_writable( |
68 | - $base_folder . JobHandlerFile::temp_folder_name . DS . $job_id |
|
68 | + $base_folder.JobHandlerFile::temp_folder_name.DS.$job_id |
|
69 | 69 | ); |
70 | 70 | } |
71 | - if( $success ) { |
|
72 | - $filepath = $base_folder . JobHandlerFile::temp_folder_name . DS . $job_id . DS. $filename; |
|
73 | - $success = $this->_file_helper->ensure_file_exists_and_is_writable( $filepath ); |
|
71 | + if ($success) { |
|
72 | + $filepath = $base_folder.JobHandlerFile::temp_folder_name.DS.$job_id.DS.$filename; |
|
73 | + $success = $this->_file_helper->ensure_file_exists_and_is_writable($filepath); |
|
74 | 74 | } |
75 | 75 | //let's add the .htaccess file so safari will open the file properly |
76 | - if( $success ) { |
|
77 | - $extension = \EEH_File::get_file_extension( $filepath ); |
|
76 | + if ($success) { |
|
77 | + $extension = \EEH_File::get_file_extension($filepath); |
|
78 | 78 | \EEH_File::write_to_file( |
79 | - $base_folder . JobHandlerFile::temp_folder_name . DS . $job_id . DS . '.htaccess', |
|
80 | - 'AddType ' . $filetype . ' ' . $extension, |
|
79 | + $base_folder.JobHandlerFile::temp_folder_name.DS.$job_id.DS.'.htaccess', |
|
80 | + 'AddType '.$filetype.' '.$extension, |
|
81 | 81 | '.htaccess' |
82 | 82 | ); |
83 | 83 | } |
84 | 84 | //those methods normally fail with an exception, but if not, let's do it |
85 | - if( ! $success ) { |
|
86 | - throw new \EE_Error( __( 'Could not create temporary file, an unknown error occurred', 'event_espresso' ) ); |
|
85 | + if ( ! $success) { |
|
86 | + throw new \EE_Error(__('Could not create temporary file, an unknown error occurred', 'event_espresso')); |
|
87 | 87 | } |
88 | - } catch( \EE_Error $e ) { |
|
88 | + } catch (\EE_Error $e) { |
|
89 | 89 | throw new BatchRequestException( |
90 | 90 | sprintf( |
91 | - __( 'Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso' ), |
|
91 | + __('Could not create temporary file for job %1$s, because: %2$s ', 'event_espresso'), |
|
92 | 92 | $job_id, |
93 | 93 | $e->getMessage() |
94 | 94 | ), |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | * @param string $filepath |
105 | 105 | * @return string url to file |
106 | 106 | */ |
107 | - public function get_url_to_file( $filepath ) { |
|
108 | - return str_replace( $this->get_base_folder(), $this->get_base_url(), $filepath ); |
|
107 | + public function get_url_to_file($filepath) { |
|
108 | + return str_replace($this->get_base_folder(), $this->get_base_url(), $filepath); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | /** |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | /** @var boolean $revisit */ |
4 | 4 | /** @var string $order_conf_desc */ |
5 | 5 | |
6 | -do_action( 'AHEE__thank_you_page_overview_template__top', $transaction ); |
|
6 | +do_action('AHEE__thank_you_page_overview_template__top', $transaction); |
|
7 | 7 | |
8 | 8 | ?> |
9 | 9 | |
10 | 10 | <div id="espresso-thank-you-page-overview-dv" class="width-100" > |
11 | 11 | |
12 | - <?php if ( ! $revisit ) : ?> |
|
12 | + <?php if ( ! $revisit) : ?> |
|
13 | 13 | <div class="ee-attention"> |
14 | 14 | <div class="extra-padding-sides"> |
15 | 15 | <?php echo apply_filters( |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | '<br />' |
22 | 22 | ) |
23 | 23 | ); |
24 | - if ( ! empty( $TXN_receipt_url )) : ?> |
|
24 | + if ( ! empty($TXN_receipt_url)) : ?> |
|
25 | 25 | <br/> |
26 | 26 | <div class="jst-rght"> |
27 | - <a class="ee-button ee-roundish indented-text big-text" href="<?php echo $TXN_receipt_url;?>"><span class="ee-icon ee-icon-PDF-file-type"></span><?php echo apply_filters( 'FHEE__thank_you_page_overview_template__order_conf_button_text', __( 'View Full Order Confirmation Receipt', 'event_espresso' )); ?></a> |
|
27 | + <a class="ee-button ee-roundish indented-text big-text" href="<?php echo $TXN_receipt_url; ?>"><span class="ee-icon ee-icon-PDF-file-type"></span><?php echo apply_filters('FHEE__thank_you_page_overview_template__order_conf_button_text', __('View Full Order Confirmation Receipt', 'event_espresso')); ?></a> |
|
28 | 28 | </div> |
29 | 29 | <?php endif; ?> |
30 | 30 | </div> |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | <?php endif; ?> |
34 | 34 | <br/> |
35 | 35 | |
36 | - <?php do_action( 'AHEE__thank_you_page_overview_template__content', $transaction ); ?> |
|
36 | + <?php do_action('AHEE__thank_you_page_overview_template__content', $transaction); ?> |
|
37 | 37 | |
38 | 38 | </div> |
39 | 39 | <!-- end of espresso-thank-you-page-overview-dv --> |
40 | 40 | |
41 | -<?php do_action( 'AHEE__thank_you_page_overview_template__bottom', $transaction ); ?> |
|
41 | +<?php do_action('AHEE__thank_you_page_overview_template__bottom', $transaction); ?> |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | * Gets an array for converting between QST_system and QST_IDs for system questions. Eg, if you want to know |
311 | 311 | * which system question QST_ID corresponds to the QST_system 'city', use EEM_Question::instance()->get_Question_ID_from_system_string('city'); |
312 | 312 | * @param $QST_system |
313 | - * @return int of QST_ID for the question that corresponds to that QST_system |
|
313 | + * @return string of QST_ID for the question that corresponds to that QST_system |
|
314 | 314 | */ |
315 | 315 | public function get_Question_ID_from_system_string( $QST_system ){ |
316 | 316 | return $this->get_var( array( array( 'QST_system' => $QST_system ) ) ); |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | |
370 | 370 | |
371 | 371 | /** |
372 | - * @return array |
|
372 | + * @return EEM_Question |
|
373 | 373 | */ |
374 | 374 | public function question_descriptions() { |
375 | 375 | return $this->_question_descriptions; |
@@ -71,10 +71,10 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @access protected |
73 | 73 | * @var array $_question_type_categories { |
74 | - * @type string $text |
|
75 | - * @type string $single-answer-enum |
|
76 | - * @type string $multi-answer-enum |
|
77 | - * } |
|
74 | + * @type string $text |
|
75 | + * @type string $single-answer-enum |
|
76 | + * @type string $multi-answer-enum |
|
77 | + * } |
|
78 | 78 | */ |
79 | 79 | protected $_question_type_categories = array(); |
80 | 80 | |
@@ -156,14 +156,14 @@ discard block |
||
156 | 156 | 'text' => array( |
157 | 157 | EEM_Question::QST_type_text, |
158 | 158 | EEM_Question::QST_type_textarea, |
159 | - EEM_Question::QST_type_date, |
|
159 | + EEM_Question::QST_type_date, |
|
160 | 160 | EEM_Question::QST_type_html_textarea, |
161 | 161 | EEM_Question::QST_type_email, |
162 | 162 | EEM_Question::QST_type_us_phone, |
163 | 163 | EEM_Question::QST_type_decimal, |
164 | - EEM_Question::QST_type_int, |
|
164 | + EEM_Question::QST_type_int, |
|
165 | 165 | EEM_Question::QST_type_url, |
166 | - EEM_Question::QST_type_year |
|
166 | + EEM_Question::QST_type_year |
|
167 | 167 | ), |
168 | 168 | 'single-answer-enum' => array( |
169 | 169 | EEM_Question::QST_type_radio, |
@@ -251,32 +251,32 @@ discard block |
||
251 | 251 | |
252 | 252 | |
253 | 253 | |
254 | - /** |
|
255 | - * Returns all the question types in the given category |
|
256 | - * @param string $category |
|
257 | - * @return array|mixed |
|
258 | - */ |
|
254 | + /** |
|
255 | + * Returns all the question types in the given category |
|
256 | + * @param string $category |
|
257 | + * @return array|mixed |
|
258 | + */ |
|
259 | 259 | public function question_types_in_category($category) |
260 | - { |
|
261 | - if( isset($this->_question_type_categories[$category])) { |
|
262 | - return $this->_question_type_categories[$category]; |
|
263 | - } |
|
264 | - return array(); |
|
265 | - } |
|
266 | - |
|
267 | - |
|
268 | - |
|
269 | - /** |
|
270 | - * Returns all the question types that should have question options |
|
271 | - * @return array |
|
272 | - */ |
|
273 | - public function question_types_with_options() |
|
274 | - { |
|
275 | - return array_merge( |
|
276 | - $this->question_types_in_category('single-answer-enum'), |
|
277 | - $this->question_types_in_category('multi-answer-enum') |
|
278 | - ); |
|
279 | - } |
|
260 | + { |
|
261 | + if( isset($this->_question_type_categories[$category])) { |
|
262 | + return $this->_question_type_categories[$category]; |
|
263 | + } |
|
264 | + return array(); |
|
265 | + } |
|
266 | + |
|
267 | + |
|
268 | + |
|
269 | + /** |
|
270 | + * Returns all the question types that should have question options |
|
271 | + * @return array |
|
272 | + */ |
|
273 | + public function question_types_with_options() |
|
274 | + { |
|
275 | + return array_merge( |
|
276 | + $this->question_types_in_category('single-answer-enum'), |
|
277 | + $this->question_types_in_category('multi-answer-enum') |
|
278 | + ); |
|
279 | + } |
|
280 | 280 | |
281 | 281 | /** |
282 | 282 | * Returns the question type categories 2d array |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
2 | 2 | exit('No direct script access allowed'); |
3 | 3 | } |
4 | -require_once( EE_MODELS . 'EEM_Soft_Delete_Base.model.php' ); |
|
5 | -require_once( EE_CLASSES . 'EE_Question.class.php' ); |
|
4 | +require_once(EE_MODELS.'EEM_Soft_Delete_Base.model.php'); |
|
5 | +require_once(EE_CLASSES.'EE_Question.class.php'); |
|
6 | 6 | |
7 | 7 | |
8 | 8 | |
@@ -105,52 +105,52 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @param null $timezone |
107 | 107 | */ |
108 | - protected function __construct( $timezone = NULL ) { |
|
109 | - $this->singular_item = __('Question','event_espresso'); |
|
110 | - $this->plural_item = __('Questions','event_espresso'); |
|
111 | - $this->_allowed_question_types=apply_filters( |
|
108 | + protected function __construct($timezone = NULL) { |
|
109 | + $this->singular_item = __('Question', 'event_espresso'); |
|
110 | + $this->plural_item = __('Questions', 'event_espresso'); |
|
111 | + $this->_allowed_question_types = apply_filters( |
|
112 | 112 | 'FHEE__EEM_Question__construct__allowed_question_types', |
113 | 113 | array( |
114 | - EEM_Question::QST_type_text =>__('Text','event_espresso'), |
|
115 | - EEM_Question::QST_type_textarea =>__('Textarea','event_espresso'), |
|
116 | - EEM_Question::QST_type_checkbox =>__('Checkboxes','event_espresso'), |
|
117 | - EEM_Question::QST_type_radio =>__('Radio Buttons','event_espresso'), |
|
118 | - EEM_Question::QST_type_dropdown =>__('Dropdown','event_espresso'), |
|
119 | - EEM_Question::QST_type_state =>__('State/Province Dropdown','event_espresso'), |
|
120 | - EEM_Question::QST_type_country =>__('Country Dropdown','event_espresso'), |
|
121 | - EEM_Question::QST_type_date =>__('Date Picker','event_espresso'), |
|
122 | - EEM_Question::QST_type_html_textarea => __( 'HTML Textarea', 'event_espresso' ), |
|
123 | - EEM_Question::QST_type_email => __( 'Email', 'event_espresso' ), |
|
124 | - EEM_Question::QST_type_us_phone => __( 'USA - Format Phone', 'event_espresso' ), |
|
125 | - EEM_Question::QST_type_decimal => __( 'Number', 'event_espresso' ), |
|
126 | - EEM_Question::QST_type_int => __( 'Whole Number', 'event_espresso' ), |
|
127 | - EEM_Question::QST_type_url => __( 'URL', 'event_espresso' ), |
|
128 | - EEM_Question::QST_type_year => __( 'Year', 'event_espresso' ), |
|
129 | - EEM_Question::QST_type_multi_select => __( 'Multi Select', 'event_espresso' ) |
|
114 | + EEM_Question::QST_type_text =>__('Text', 'event_espresso'), |
|
115 | + EEM_Question::QST_type_textarea =>__('Textarea', 'event_espresso'), |
|
116 | + EEM_Question::QST_type_checkbox =>__('Checkboxes', 'event_espresso'), |
|
117 | + EEM_Question::QST_type_radio =>__('Radio Buttons', 'event_espresso'), |
|
118 | + EEM_Question::QST_type_dropdown =>__('Dropdown', 'event_espresso'), |
|
119 | + EEM_Question::QST_type_state =>__('State/Province Dropdown', 'event_espresso'), |
|
120 | + EEM_Question::QST_type_country =>__('Country Dropdown', 'event_espresso'), |
|
121 | + EEM_Question::QST_type_date =>__('Date Picker', 'event_espresso'), |
|
122 | + EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'), |
|
123 | + EEM_Question::QST_type_email => __('Email', 'event_espresso'), |
|
124 | + EEM_Question::QST_type_us_phone => __('USA - Format Phone', 'event_espresso'), |
|
125 | + EEM_Question::QST_type_decimal => __('Number', 'event_espresso'), |
|
126 | + EEM_Question::QST_type_int => __('Whole Number', 'event_espresso'), |
|
127 | + EEM_Question::QST_type_url => __('URL', 'event_espresso'), |
|
128 | + EEM_Question::QST_type_year => __('Year', 'event_espresso'), |
|
129 | + EEM_Question::QST_type_multi_select => __('Multi Select', 'event_espresso') |
|
130 | 130 | ) |
131 | 131 | ); |
132 | 132 | $this->_question_descriptions = apply_filters( |
133 | 133 | 'FHEE__EEM_Question__construct__allowed_question_types', |
134 | 134 | array( |
135 | - EEM_Question::QST_type_text => __( 'A single line text input field', 'event_espresso' ), |
|
136 | - EEM_Question::QST_type_textarea => __( 'A multi line text input field', 'event_espresso' ), |
|
137 | - EEM_Question::QST_type_checkbox => __( 'Allows multiple preset options to be selected', 'event_espresso' ), |
|
138 | - EEM_Question::QST_type_radio => __( 'Allows a single preset option to be selected', 'event_espresso' ), |
|
139 | - EEM_Question::QST_type_dropdown => __( 'A dropdown that allows a single selection', 'event_espresso' ), |
|
140 | - EEM_Question::QST_type_state => __( 'A dropdown that lists states/provinces', 'event_espresso' ), |
|
141 | - EEM_Question::QST_type_country => __( 'A dropdown that lists countries', 'event_espresso' ), |
|
142 | - EEM_Question::QST_type_date => __( 'A popup calendar that allows date selections', 'event_espresso' ), |
|
143 | - EEM_Question::QST_type_html_textarea => __( 'A multi line text input field that allows HTML', 'event_espresso' ), |
|
144 | - EEM_Question::QST_type_email => __( 'A text field that must contain a valid Email address', 'event_espresso' ), |
|
145 | - EEM_Question::QST_type_us_phone => __( 'A text field that must contain a valid US phone number', 'event_espresso' ), |
|
146 | - EEM_Question::QST_type_decimal => __( 'A text field that allows number values with decimals', 'event_espresso' ), |
|
147 | - EEM_Question::QST_type_int => __( 'A text field that only allows whole numbers (no decimals)', 'event_espresso' ), |
|
148 | - EEM_Question::QST_type_url => __( 'A text field that must contain a valid URL', 'event_espresso' ), |
|
149 | - EEM_Question::QST_type_year => __( 'A dropdown that lists the last 100 years', 'event_espresso' ), |
|
150 | - EEM_Question::QST_type_multi_select => __( 'A dropdown that allows multiple selections', 'event_espresso' ) |
|
135 | + EEM_Question::QST_type_text => __('A single line text input field', 'event_espresso'), |
|
136 | + EEM_Question::QST_type_textarea => __('A multi line text input field', 'event_espresso'), |
|
137 | + EEM_Question::QST_type_checkbox => __('Allows multiple preset options to be selected', 'event_espresso'), |
|
138 | + EEM_Question::QST_type_radio => __('Allows a single preset option to be selected', 'event_espresso'), |
|
139 | + EEM_Question::QST_type_dropdown => __('A dropdown that allows a single selection', 'event_espresso'), |
|
140 | + EEM_Question::QST_type_state => __('A dropdown that lists states/provinces', 'event_espresso'), |
|
141 | + EEM_Question::QST_type_country => __('A dropdown that lists countries', 'event_espresso'), |
|
142 | + EEM_Question::QST_type_date => __('A popup calendar that allows date selections', 'event_espresso'), |
|
143 | + EEM_Question::QST_type_html_textarea => __('A multi line text input field that allows HTML', 'event_espresso'), |
|
144 | + EEM_Question::QST_type_email => __('A text field that must contain a valid Email address', 'event_espresso'), |
|
145 | + EEM_Question::QST_type_us_phone => __('A text field that must contain a valid US phone number', 'event_espresso'), |
|
146 | + EEM_Question::QST_type_decimal => __('A text field that allows number values with decimals', 'event_espresso'), |
|
147 | + EEM_Question::QST_type_int => __('A text field that only allows whole numbers (no decimals)', 'event_espresso'), |
|
148 | + EEM_Question::QST_type_url => __('A text field that must contain a valid URL', 'event_espresso'), |
|
149 | + EEM_Question::QST_type_year => __('A dropdown that lists the last 100 years', 'event_espresso'), |
|
150 | + EEM_Question::QST_type_multi_select => __('A dropdown that allows multiple selections', 'event_espresso') |
|
151 | 151 | ) |
152 | 152 | ); |
153 | - $this->_question_type_categories = (array)apply_filters( |
|
153 | + $this->_question_type_categories = (array) apply_filters( |
|
154 | 154 | 'FHEE__EEM_Question__construct__question_type_categories', |
155 | 155 | array( |
156 | 156 | 'text' => array( |
@@ -177,22 +177,22 @@ discard block |
||
177 | 177 | ); |
178 | 178 | |
179 | 179 | $this->_tables = array( |
180 | - 'Question'=>new EE_Primary_Table('esp_question','QST_ID') |
|
180 | + 'Question'=>new EE_Primary_Table('esp_question', 'QST_ID') |
|
181 | 181 | ); |
182 | 182 | $this->_fields = array( |
183 | 183 | 'Question'=>array( |
184 | - 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID','event_espresso')), |
|
185 | - 'QST_display_text'=>new EE_Post_Content_Field('QST_display_text', __('Question Text','event_espresso'), true, ''), |
|
186 | - 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)','event_espresso'), true, ''), |
|
187 | - 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question','event_espresso'), false, '' ), |
|
188 | - 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type','event_espresso'),false, 'TEXT',$this->_allowed_question_types), |
|
189 | - 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?','event_espresso'), false, false), |
|
190 | - 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided','event_espresso'), true, ''), |
|
191 | - 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order','event_espresso'), false, 0), |
|
192 | - 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?','event_espresso'), false, false), |
|
193 | - 'QST_max' => new EE_Infinite_Integer_Field( 'QST_max', __( 'Max Size', 'event_espresso' ), false, EE_INF ), |
|
194 | - 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID','event_espresso'), false ), |
|
195 | - 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted','event_espresso'), false, false) |
|
184 | + 'QST_ID'=>new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')), |
|
185 | + 'QST_display_text'=>new EE_Post_Content_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''), |
|
186 | + 'QST_admin_label'=>new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''), |
|
187 | + 'QST_system'=>new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), false, ''), |
|
188 | + 'QST_type'=>new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types), |
|
189 | + 'QST_required'=>new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false), |
|
190 | + 'QST_required_text'=>new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''), |
|
191 | + 'QST_order'=>new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0), |
|
192 | + 'QST_admin_only'=>new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false), |
|
193 | + 'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF), |
|
194 | + 'QST_wp_user'=>new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false), |
|
195 | + 'QST_deleted'=>new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false) |
|
196 | 196 | ) |
197 | 197 | ); |
198 | 198 | $this->_model_relations = array( |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | 'Question_Group_Question'=>new EE_Has_Many_Relation() |
205 | 205 | ); |
206 | 206 | //this model is generally available for reading |
207 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
208 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
209 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
210 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
211 | - parent::__construct( $timezone ); |
|
207 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
208 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
209 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
210 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system'); |
|
211 | + parent::__construct($timezone); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | * but they can be extended |
217 | 217 | * @return string[] |
218 | 218 | */ |
219 | - public function allowed_question_types(){ |
|
219 | + public function allowed_question_types() { |
|
220 | 220 | return $this->_allowed_question_types; |
221 | 221 | } |
222 | 222 | /** |
@@ -224,16 +224,16 @@ discard block |
||
224 | 224 | * @param string $question_type one of EEM_Question::allowed_question_types( |
225 | 225 | * @return string[] like EEM_Question::allowed_question_types() |
226 | 226 | */ |
227 | - public function question_types_in_same_category( $question_type ) { |
|
228 | - $question_types = array( $question_type ); |
|
229 | - foreach( $this->_question_type_categories as $category => $question_types_in_category ) { |
|
230 | - if( in_array( $question_type, $question_types_in_category ) ) { |
|
227 | + public function question_types_in_same_category($question_type) { |
|
228 | + $question_types = array($question_type); |
|
229 | + foreach ($this->_question_type_categories as $category => $question_types_in_category) { |
|
230 | + if (in_array($question_type, $question_types_in_category)) { |
|
231 | 231 | $question_types = $question_types_in_category; |
232 | 232 | break; |
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | - return array_intersect_key( $this->allowed_question_types(), array_flip( $question_types ) ); |
|
236 | + return array_intersect_key($this->allowed_question_types(), array_flip($question_types)); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | * @param string $category one of the top-level keys of EEM_Question::question_type_categories() |
243 | 243 | * @return boolean |
244 | 244 | */ |
245 | - public function question_type_is_in_category( $question_type, $category ) { |
|
246 | - if( ! isset( $this->_question_type_categories[ $category ] ) ) { |
|
245 | + public function question_type_is_in_category($question_type, $category) { |
|
246 | + if ( ! isset($this->_question_type_categories[$category])) { |
|
247 | 247 | return false; |
248 | 248 | } |
249 | - return in_array( $question_type, $this->_question_type_categories[ $category ] ); |
|
249 | + return in_array($question_type, $this->_question_type_categories[$category]); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | */ |
259 | 259 | public function question_types_in_category($category) |
260 | 260 | { |
261 | - if( isset($this->_question_type_categories[$category])) { |
|
261 | + if (isset($this->_question_type_categories[$category])) { |
|
262 | 262 | return $this->_question_type_categories[$category]; |
263 | 263 | } |
264 | 264 | return array(); |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | * @param string $system_question_group_id QSG_system |
293 | 293 | * @return array of system question names (QST_system) |
294 | 294 | */ |
295 | - public function allowed_system_questions_in_system_question_group( $system_question_group_id ) { |
|
295 | + public function allowed_system_questions_in_system_question_group($system_question_group_id) { |
|
296 | 296 | $question_system_ids = array(); |
297 | - switch( $system_question_group_id ) { |
|
297 | + switch ($system_question_group_id) { |
|
298 | 298 | case EEM_Question_Group::system_personal: |
299 | 299 | $question_system_ids = array( |
300 | 300 | EEM_Attendee::system_question_fname, |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | ); |
316 | 316 | break; |
317 | 317 | } |
318 | - return apply_filters( 'FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id ); |
|
318 | + return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id); |
|
319 | 319 | } |
320 | 320 | |
321 | 321 | /** |
@@ -324,11 +324,11 @@ discard block |
||
324 | 324 | * @param string $system_question_group_id QSG_system |
325 | 325 | * @return array of system question names (QST_system) |
326 | 326 | */ |
327 | - public function required_system_questions_in_system_question_group( $system_question_group_id ) { |
|
327 | + public function required_system_questions_in_system_question_group($system_question_group_id) { |
|
328 | 328 | $question_system_ids = null; |
329 | - switch( $system_question_group_id ) { |
|
329 | + switch ($system_question_group_id) { |
|
330 | 330 | case EEM_Question_Group::system_personal: |
331 | - $question_system_ids = array( |
|
331 | + $question_system_ids = array( |
|
332 | 332 | EEM_Attendee::system_question_fname, |
333 | 333 | EEM_Attendee::system_question_email, |
334 | 334 | ); |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | default: |
337 | 337 | $question_system_ids = array(); |
338 | 338 | } |
339 | - return apply_filters( 'FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id ); |
|
339 | + return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id); |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | |
@@ -347,8 +347,8 @@ discard block |
||
347 | 347 | * @param $QST_system |
348 | 348 | * @return int of QST_ID for the question that corresponds to that QST_system |
349 | 349 | */ |
350 | - public function get_Question_ID_from_system_string( $QST_system ){ |
|
351 | - return $this->get_var( array( array( 'QST_system' => $QST_system ) ) ); |
|
350 | + public function get_Question_ID_from_system_string($QST_system) { |
|
351 | + return $this->get_var(array(array('QST_system' => $QST_system))); |
|
352 | 352 | } |
353 | 353 | |
354 | 354 | |
@@ -360,10 +360,10 @@ discard block |
||
360 | 360 | */ |
361 | 361 | public function get_latest_question_order() { |
362 | 362 | $columns_to_select = array( |
363 | - 'max_order' => array("MAX(QST_order)","%d") |
|
363 | + 'max_order' => array("MAX(QST_order)", "%d") |
|
364 | 364 | ); |
365 | - $max = $this->_get_all_wpdb_results( array(), ARRAY_A, $columns_to_select ); |
|
366 | - return isset( $max[0], $max[0]['max_order'] ) ? $max[0]['max_order'] : 0; |
|
365 | + $max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select); |
|
366 | + return isset($max[0], $max[0]['max_order']) ? $max[0]['max_order'] : 0; |
|
367 | 367 | } |
368 | 368 | |
369 | 369 | /** |
@@ -392,10 +392,10 @@ discard block |
||
392 | 392 | * @param string $system_question_value |
393 | 393 | * @return int|float |
394 | 394 | */ |
395 | - public function absolute_max_for_system_question( $system_question_value ) { |
|
395 | + public function absolute_max_for_system_question($system_question_value) { |
|
396 | 396 | $maxes = $this->system_question_maxes(); |
397 | - if( isset( $maxes[ $system_question_value ] ) ) { |
|
398 | - return $maxes[ $system_question_value ]; |
|
397 | + if (isset($maxes[$system_question_value])) { |
|
398 | + return $maxes[$system_question_value]; |
|
399 | 399 | } else { |
400 | 400 | return EE_INF; |
401 | 401 | } |
@@ -161,7 +161,7 @@ |
||
161 | 161 | * @param EE_Transaction $transaction |
162 | 162 | * @param string $payment_status One of EEM_Payment's statuses, like 'PAP' (Approved). |
163 | 163 | * By default, searches for approved payments |
164 | - * @return float|false float on success, false on fail |
|
164 | + * @return double float on success, false on fail |
|
165 | 165 | * @throws \EE_Error |
166 | 166 | */ |
167 | 167 | public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) { |
@@ -233,8 +233,8 @@ |
||
233 | 233 | if ( $registration instanceof EE_Registration ) { |
234 | 234 | $registration->set_paid( $registration->paid() - $amount_paid ); |
235 | 235 | if ($registration->save() !== false) { |
236 | - $registration_payment->delete_permanently(); |
|
237 | - $save_payment = true; |
|
236 | + $registration_payment->delete_permanently(); |
|
237 | + $save_payment = true; |
|
238 | 238 | } |
239 | 239 | } else { |
240 | 240 | EE_Error::add_error( |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
2 | -EE_Registry::instance()->load_class( 'Processor_Base' ); |
|
2 | +EE_Registry::instance()->load_class('Processor_Base'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * Class EE_Transaction_Payments |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public static function instance() { |
44 | 44 | // check if class object is instantiated |
45 | - if ( ! self::$_instance instanceof EE_Transaction_Payments ) { |
|
45 | + if ( ! self::$_instance instanceof EE_Transaction_Payments) { |
|
46 | 46 | self::$_instance = new self(); |
47 | 47 | } |
48 | 48 | return self::$_instance; |
@@ -59,18 +59,18 @@ discard block |
||
59 | 59 | * @return bool true if TXN total was updated, false if not |
60 | 60 | * @throws \EE_Error |
61 | 61 | */ |
62 | - public function recalculate_transaction_total( EE_Transaction $transaction, $update_txn = true ) { |
|
62 | + public function recalculate_transaction_total(EE_Transaction $transaction, $update_txn = true) { |
|
63 | 63 | $total_line_item = $transaction->total_line_item(); |
64 | - if ( ! $total_line_item instanceof EE_Line_Item ) { |
|
64 | + if ( ! $total_line_item instanceof EE_Line_Item) { |
|
65 | 65 | EE_Error::add_error( |
66 | - sprintf( __( 'The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso' ), $transaction->ID() ), |
|
66 | + sprintf(__('The Total Line Item for Transaction %1$d\'s was not found or is invalid.', 'event_espresso'), $transaction->ID()), |
|
67 | 67 | __FILE__, __FUNCTION__, __LINE__ |
68 | 68 | ); |
69 | 69 | return false; |
70 | 70 | } |
71 | 71 | $new_total = $total_line_item->recalculate_total_including_taxes(); |
72 | - $transaction->set_total( $new_total ); |
|
73 | - if ( $update_txn ) { |
|
72 | + $transaction->set_total($new_total); |
|
73 | + if ($update_txn) { |
|
74 | 74 | return $transaction->save() ? true : false; |
75 | 75 | } |
76 | 76 | return false; |
@@ -93,20 +93,20 @@ discard block |
||
93 | 93 | * @return boolean whether the TXN was saved |
94 | 94 | * @throws \EE_Error |
95 | 95 | */ |
96 | - public function calculate_total_payments_and_update_status( EE_Transaction $transaction, $update_txn = true ){ |
|
96 | + public function calculate_total_payments_and_update_status(EE_Transaction $transaction, $update_txn = true) { |
|
97 | 97 | // verify transaction |
98 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
99 | - EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
98 | + if ( ! $transaction instanceof EE_Transaction) { |
|
99 | + EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
100 | 100 | return false; |
101 | 101 | } |
102 | 102 | // calculate total paid |
103 | - $total_paid = $this->recalculate_total_payments_for_transaction( $transaction ); |
|
103 | + $total_paid = $this->recalculate_total_payments_for_transaction($transaction); |
|
104 | 104 | // if total paid has changed |
105 | - if ( $total_paid !== false && (float)$total_paid !== $transaction->paid() ) { |
|
106 | - $transaction->set_paid( $total_paid ); |
|
105 | + if ($total_paid !== false && (float) $total_paid !== $transaction->paid()) { |
|
106 | + $transaction->set_paid($total_paid); |
|
107 | 107 | // maybe update status, and make sure to save transaction if not done already |
108 | - if ( ! $transaction->update_status_based_on_total_paid( $update_txn ) ) { |
|
109 | - if ( $update_txn ) { |
|
108 | + if ( ! $transaction->update_status_based_on_total_paid($update_txn)) { |
|
109 | + if ($update_txn) { |
|
110 | 110 | return $transaction->save() ? true : false; |
111 | 111 | } |
112 | 112 | } else { |
@@ -130,18 +130,18 @@ discard block |
||
130 | 130 | * @return float|false float on success, false on fail |
131 | 131 | * @throws \EE_Error |
132 | 132 | */ |
133 | - public function recalculate_total_payments_for_transaction( EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved ) { |
|
133 | + public function recalculate_total_payments_for_transaction(EE_Transaction $transaction, $payment_status = EEM_Payment::status_id_approved) { |
|
134 | 134 | // verify transaction |
135 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
136 | - EE_Error::add_error( __( 'Please provide a valid EE_Transaction object.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
135 | + if ( ! $transaction instanceof EE_Transaction) { |
|
136 | + EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
137 | 137 | return false; |
138 | 138 | } |
139 | 139 | // ensure Payment model is loaded |
140 | - EE_Registry::instance()->load_model( 'Payment' ); |
|
140 | + EE_Registry::instance()->load_model('Payment'); |
|
141 | 141 | // calls EEM_Base::sum() |
142 | 142 | return EEM_Payment::instance()->sum( |
143 | 143 | // query params |
144 | - array( array( 'TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status )), |
|
144 | + array(array('TXN_ID' => $transaction->ID(), 'STS_ID' => $payment_status)), |
|
145 | 145 | // field to sum |
146 | 146 | 'PAY_amount' |
147 | 147 | ); |
@@ -159,17 +159,17 @@ discard block |
||
159 | 159 | * @return boolean |
160 | 160 | * @throws \EE_Error |
161 | 161 | */ |
162 | - public function delete_payment_and_update_transaction( EE_Payment $payment ) { |
|
162 | + public function delete_payment_and_update_transaction(EE_Payment $payment) { |
|
163 | 163 | // verify payment |
164 | - if ( ! $payment instanceof EE_Payment ) { |
|
165 | - EE_Error::add_error( __( 'A valid Payment object was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
164 | + if ( ! $payment instanceof EE_Payment) { |
|
165 | + EE_Error::add_error(__('A valid Payment object was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
166 | 166 | return false; |
167 | 167 | } |
168 | - if ( ! $this->delete_registration_payments_and_update_registrations( $payment ) ) { |
|
168 | + if ( ! $this->delete_registration_payments_and_update_registrations($payment)) { |
|
169 | 169 | return false; |
170 | 170 | } |
171 | - if ( ! $payment->delete() ) { |
|
172 | - EE_Error::add_error( __( 'The payment could not be deleted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
171 | + if ( ! $payment->delete()) { |
|
172 | + EE_Error::add_error(__('The payment could not be deleted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
173 | 173 | return false; |
174 | 174 | } |
175 | 175 | |
@@ -180,14 +180,14 @@ discard block |
||
180 | 180 | || $TXN_status === EEM_Transaction::failed_status_code |
181 | 181 | || $payment->amount() === 0 |
182 | 182 | ) { |
183 | - EE_Error::add_success( __( 'The Payment was successfully deleted.', 'event_espresso' ) ); |
|
183 | + EE_Error::add_success(__('The Payment was successfully deleted.', 'event_espresso')); |
|
184 | 184 | return true; |
185 | 185 | } |
186 | 186 | |
187 | 187 | |
188 | 188 | //if this fails, that just means that the transaction didn't get its status changed and/or updated. |
189 | 189 | //however the payment was still deleted. |
190 | - if ( ! $this->calculate_total_payments_and_update_status( $transaction ) ) { |
|
190 | + if ( ! $this->calculate_total_payments_and_update_status($transaction)) { |
|
191 | 191 | |
192 | 192 | EE_Error::add_attention( |
193 | 193 | __( |
@@ -221,17 +221,17 @@ discard block |
||
221 | 221 | * @return bool |
222 | 222 | * @throws \EE_Error |
223 | 223 | */ |
224 | - public function delete_registration_payments_and_update_registrations( EE_Payment $payment, $reg_payment_query_params = array() ) { |
|
224 | + public function delete_registration_payments_and_update_registrations(EE_Payment $payment, $reg_payment_query_params = array()) { |
|
225 | 225 | $save_payment = false; |
226 | - $reg_payment_query_params = ! empty( $reg_payment_query_params ) ? $reg_payment_query_params : array( array( 'PAY_ID' => $payment->ID() ) ); |
|
227 | - $registration_payments = EEM_Registration_Payment::instance()->get_all( $reg_payment_query_params ); |
|
228 | - if ( ! empty( $registration_payments )) { |
|
229 | - foreach ( $registration_payments as $registration_payment ) { |
|
230 | - if ( $registration_payment instanceof EE_Registration_Payment ) { |
|
226 | + $reg_payment_query_params = ! empty($reg_payment_query_params) ? $reg_payment_query_params : array(array('PAY_ID' => $payment->ID())); |
|
227 | + $registration_payments = EEM_Registration_Payment::instance()->get_all($reg_payment_query_params); |
|
228 | + if ( ! empty($registration_payments)) { |
|
229 | + foreach ($registration_payments as $registration_payment) { |
|
230 | + if ($registration_payment instanceof EE_Registration_Payment) { |
|
231 | 231 | $amount_paid = $registration_payment->amount(); |
232 | 232 | $registration = $registration_payment->registration(); |
233 | - if ( $registration instanceof EE_Registration ) { |
|
234 | - $registration->set_paid( $registration->paid() - $amount_paid ); |
|
233 | + if ($registration instanceof EE_Registration) { |
|
234 | + $registration->set_paid($registration->paid() - $amount_paid); |
|
235 | 235 | if ($registration->save() !== false) { |
236 | 236 | $registration_payment->delete_permanently(); |
237 | 237 | $save_payment = true; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | } else { |
240 | 240 | EE_Error::add_error( |
241 | 241 | sprintf( |
242 | - __( 'An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso' ), |
|
242 | + __('An invalid Registration object was associated with Registration Payment ID# %1$d.', 'event_espresso'), |
|
243 | 243 | $registration_payment->ID() |
244 | 244 | ), |
245 | 245 | __FILE__, __FUNCTION__, __LINE__ |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | } else { |
250 | 250 | EE_Error::add_error( |
251 | 251 | sprintf( |
252 | - __( 'An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso' ), |
|
252 | + __('An invalid Registration Payment object was associated with payment ID# %1$d.', 'event_espresso'), |
|
253 | 253 | $payment->ID() |
254 | 254 | ), |
255 | 255 | __FILE__, __FUNCTION__, __LINE__ |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | } |
259 | 259 | } |
260 | 260 | } |
261 | - if ( $save_payment ) { |
|
261 | + if ($save_payment) { |
|
262 | 262 | $payment->save(); |
263 | 263 | } |
264 | 264 | return true; |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | public function update_transaction_status_based_on_total_paid(EE_Transaction $transaction, $update_txn = true) |
283 | 283 | { |
284 | 284 | EE_Error::doing_it_wrong( |
285 | - __CLASS__ . '::' . __FUNCTION__, |
|
285 | + __CLASS__.'::'.__FUNCTION__, |
|
286 | 286 | sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), |
287 | 287 | 'EE_Transaction::update_status_based_on_total_paid()'), |
288 | 288 | '4.9.1', |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * @deprecated 4.9.12 |
325 | 325 | * @param string $old_txn_status |
326 | 326 | */ |
327 | - public function set_old_txn_status( $old_txn_status ) { |
|
327 | + public function set_old_txn_status($old_txn_status) { |
|
328 | 328 | EE_Error::doing_it_wrong( |
329 | 329 | __METHOD__, |
330 | 330 | esc_html__( |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | '4.9.12' |
335 | 335 | ); |
336 | 336 | // only set the first time |
337 | - if ( $this->_old_txn_status === null ) { |
|
337 | + if ($this->_old_txn_status === null) { |
|
338 | 338 | $this->_old_txn_status = $old_txn_status; |
339 | 339 | } |
340 | 340 | } |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | * @deprecated 4.9.12 |
364 | 364 | * @param string $new_txn_status |
365 | 365 | */ |
366 | - public function set_new_txn_status( $new_txn_status ) { |
|
366 | + public function set_new_txn_status($new_txn_status) { |
|
367 | 367 | EE_Error::doing_it_wrong( |
368 | 368 | __METHOD__, |
369 | 369 | esc_html__( |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | * Adds an option for this question. Note: if the option were previously associated with a different |
370 | 370 | * Question, that relationship will be overwritten. |
371 | 371 | * @param EE_Question_Option $option |
372 | - * @return boolean success |
|
372 | + * @return EE_Base_Class success |
|
373 | 373 | */ |
374 | 374 | public function add_option( EE_Question_Option $option ) { |
375 | 375 | return $this->_add_relation_to( $option, 'Question_Option' ); |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | /** |
393 | 393 | * Marks the option as deleted. |
394 | 394 | * @param EE_Question_Option $option |
395 | - * @return boolean success |
|
395 | + * @return EE_Base_Class success |
|
396 | 396 | */ |
397 | 397 | public function remove_option( EE_Question_Option $option ) { |
398 | 398 | return $this->_remove_relation_to( $option, 'Question_Option' ); |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -37,9 +37,9 @@ discard block |
||
37 | 37 | * date_format and the second value is the time format |
38 | 38 | * @return EE_Question |
39 | 39 | */ |
40 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
41 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
42 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
40 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
41 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
42 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * the website will be used. |
51 | 51 | * @return EE_Question |
52 | 52 | */ |
53 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
54 | - return new self( $props_n_values, TRUE, $timezone ); |
|
53 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
54 | + return new self($props_n_values, TRUE, $timezone); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | * @access public |
63 | 63 | * @param string $QST_display_text |
64 | 64 | */ |
65 | - public function set_display_text( $QST_display_text = '' ) { |
|
66 | - $this->set( 'QST_display_text', $QST_display_text ); |
|
65 | + public function set_display_text($QST_display_text = '') { |
|
66 | + $this->set('QST_display_text', $QST_display_text); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | * @access public |
75 | 75 | * @param string $QST_admin_label |
76 | 76 | */ |
77 | - public function set_admin_label( $QST_admin_label = '' ) { |
|
78 | - $this->set( 'QST_admin_label', $QST_admin_label ); |
|
77 | + public function set_admin_label($QST_admin_label = '') { |
|
78 | + $this->set('QST_admin_label', $QST_admin_label); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | * @access public |
87 | 87 | * @param mixed $QST_system |
88 | 88 | */ |
89 | - public function set_system_ID( $QST_system = '' ) { |
|
90 | - $this->set( 'QST_system', $QST_system ); |
|
89 | + public function set_system_ID($QST_system = '') { |
|
90 | + $this->set('QST_system', $QST_system); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | * @access public |
99 | 99 | * @param string $QST_type |
100 | 100 | */ |
101 | - public function set_question_type( $QST_type = '' ) { |
|
102 | - $this->set( 'QST_type', $QST_type ); |
|
101 | + public function set_question_type($QST_type = '') { |
|
102 | + $this->set('QST_type', $QST_type); |
|
103 | 103 | } |
104 | 104 | |
105 | 105 | |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | * @access public |
111 | 111 | * @param bool $QST_required |
112 | 112 | */ |
113 | - public function set_required( $QST_required = FALSE ) { |
|
114 | - $this->set( 'QST_required', $QST_required ); |
|
113 | + public function set_required($QST_required = FALSE) { |
|
114 | + $this->set('QST_required', $QST_required); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | * @access public |
123 | 123 | * @param string $QST_required_text |
124 | 124 | */ |
125 | - public function set_required_text( $QST_required_text = '' ) { |
|
126 | - $this->set( 'QST_required_text', $QST_required_text ); |
|
125 | + public function set_required_text($QST_required_text = '') { |
|
126 | + $this->set('QST_required_text', $QST_required_text); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | * @access public |
135 | 135 | * @param int $QST_order |
136 | 136 | */ |
137 | - public function set_order( $QST_order = 0 ) { |
|
138 | - $this->set( 'QST_order', $QST_order ); |
|
137 | + public function set_order($QST_order = 0) { |
|
138 | + $this->set('QST_order', $QST_order); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | * @access public |
147 | 147 | * @param bool $QST_admin_only |
148 | 148 | */ |
149 | - public function set_admin_only( $QST_admin_only = FALSE ) { |
|
150 | - $this->set( 'QST_admin_only', $QST_admin_only ); |
|
149 | + public function set_admin_only($QST_admin_only = FALSE) { |
|
150 | + $this->set('QST_admin_only', $QST_admin_only); |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | * @access public |
159 | 159 | * @param int $QST_wp_user |
160 | 160 | */ |
161 | - public function set_wp_user( $QST_wp_user = 1 ) { |
|
162 | - $this->set( 'QST_wp_user', $QST_wp_user ); |
|
161 | + public function set_wp_user($QST_wp_user = 1) { |
|
162 | + $this->set('QST_wp_user', $QST_wp_user); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | |
@@ -175,8 +175,8 @@ discard block |
||
175 | 175 | * @access public |
176 | 176 | * @param bool $QST_deleted |
177 | 177 | */ |
178 | - public function set_deleted( $QST_deleted = FALSE ) { |
|
179 | - $this->set( 'QST_deleted', $QST_deleted ); |
|
178 | + public function set_deleted($QST_deleted = FALSE) { |
|
179 | + $this->set('QST_deleted', $QST_deleted); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @return string |
188 | 188 | */ |
189 | 189 | public function display_text() { |
190 | - return $this->get( 'QST_display_text' ); |
|
190 | + return $this->get('QST_display_text'); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * @return string |
199 | 199 | */ |
200 | 200 | public function admin_label() { |
201 | - return $this->get( 'QST_admin_label' ); |
|
201 | + return $this->get('QST_admin_label'); |
|
202 | 202 | } |
203 | 203 | |
204 | 204 | |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @return string |
210 | 210 | */ |
211 | 211 | public function system_ID() { |
212 | - return $this->get( 'QST_system' ); |
|
212 | + return $this->get('QST_system'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | * @return boolean |
221 | 221 | */ |
222 | 222 | public function required() { |
223 | - return $this->get( 'QST_required' ); |
|
223 | + return $this->get('QST_required'); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @return string |
233 | 233 | */ |
234 | 234 | public function required_text() { |
235 | - return $this->get( 'QST_required_text' ); |
|
235 | + return $this->get('QST_required_text'); |
|
236 | 236 | } |
237 | 237 | |
238 | 238 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @return string |
244 | 244 | */ |
245 | 245 | public function type() { |
246 | - return $this->get( 'QST_type' ); |
|
246 | + return $this->get('QST_type'); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | * @return int |
256 | 256 | */ |
257 | 257 | public function order() { |
258 | - return $this->get( 'QST_order' ); |
|
258 | + return $this->get('QST_order'); |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @return boolean |
268 | 268 | */ |
269 | 269 | public function admin_only() { |
270 | - return $this->get( 'QST_admin_only' ); |
|
270 | + return $this->get('QST_admin_only'); |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * @return int |
279 | 279 | */ |
280 | 280 | public function wp_user() { |
281 | - return $this->get( 'QST_wp_user' ); |
|
281 | + return $this->get('QST_wp_user'); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | * @return boolean |
290 | 290 | */ |
291 | 291 | public function deleted() { |
292 | - return $this->get( 'QST_deleted' ); |
|
292 | + return $this->get('QST_deleted'); |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | * @return EE_Answer[] |
300 | 300 | */ |
301 | 301 | public function answers() { |
302 | - return $this->get_many_related( 'Answer' ); |
|
302 | + return $this->get_many_related('Answer'); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * @return boolean true = has answers, false = no answers. |
310 | 310 | */ |
311 | 311 | public function has_answers() { |
312 | - return $this->count_related( 'Answer' ) > 0 ? TRUE : FALSE; |
|
312 | + return $this->count_related('Answer') > 0 ? TRUE : FALSE; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @return EE_Question_Group[] |
320 | 320 | */ |
321 | 321 | public function question_groups() { |
322 | - return $this->get_many_related( 'Question_Group' ); |
|
322 | + return $this->get_many_related('Question_Group'); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -333,24 +333,24 @@ discard block |
||
333 | 333 | * whether it was trashed or not. |
334 | 334 | * @return EE_Question_Option[] |
335 | 335 | */ |
336 | - public function options( $notDeletedOptionsOnly = TRUE, $selected_value_to_always_include = NULL ) { |
|
337 | - if ( ! $this->ID() ) { |
|
336 | + public function options($notDeletedOptionsOnly = TRUE, $selected_value_to_always_include = NULL) { |
|
337 | + if ( ! $this->ID()) { |
|
338 | 338 | return array(); |
339 | 339 | } |
340 | 340 | $query_params = array(); |
341 | - if ( $selected_value_to_always_include ) { |
|
342 | - if ( is_array( $selected_value_to_always_include ) ) { |
|
343 | - $query_params[ 0 ][ 'OR*options-query' ][ 'QSO_value' ] = array( 'IN', $selected_value_to_always_include ); |
|
341 | + if ($selected_value_to_always_include) { |
|
342 | + if (is_array($selected_value_to_always_include)) { |
|
343 | + $query_params[0]['OR*options-query']['QSO_value'] = array('IN', $selected_value_to_always_include); |
|
344 | 344 | } else { |
345 | - $query_params[ 0 ][ 'OR*options-query' ][ 'QSO_value' ] = $selected_value_to_always_include; |
|
345 | + $query_params[0]['OR*options-query']['QSO_value'] = $selected_value_to_always_include; |
|
346 | 346 | } |
347 | 347 | } |
348 | - if ( $notDeletedOptionsOnly ) { |
|
349 | - $query_params[ 0 ][ 'OR*options-query' ][ 'QSO_deleted' ] = FALSE; |
|
348 | + if ($notDeletedOptionsOnly) { |
|
349 | + $query_params[0]['OR*options-query']['QSO_deleted'] = FALSE; |
|
350 | 350 | } |
351 | 351 | //order by QSO_order |
352 | - $query_params[ 'order_by' ] = array( 'QSO_order' => 'ASC' ); |
|
353 | - return $this->get_many_related( 'Question_Option', $query_params ); |
|
352 | + $query_params['order_by'] = array('QSO_order' => 'ASC'); |
|
353 | + return $this->get_many_related('Question_Option', $query_params); |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * @return \EE_Question_Option[] |
361 | 361 | */ |
362 | 362 | public function temp_options() { |
363 | - return $this->_model_relations[ 'Question_Option' ]; |
|
363 | + return $this->_model_relations['Question_Option']; |
|
364 | 364 | } |
365 | 365 | |
366 | 366 | |
@@ -371,8 +371,8 @@ discard block |
||
371 | 371 | * @param EE_Question_Option $option |
372 | 372 | * @return boolean success |
373 | 373 | */ |
374 | - public function add_option( EE_Question_Option $option ) { |
|
375 | - return $this->_add_relation_to( $option, 'Question_Option' ); |
|
374 | + public function add_option(EE_Question_Option $option) { |
|
375 | + return $this->_add_relation_to($option, 'Question_Option'); |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | * @param EE_Question_Option $option |
383 | 383 | * @return boolean success |
384 | 384 | */ |
385 | - public function add_temp_option( EE_Question_Option $option ) { |
|
386 | - $this->_model_relations[ 'Question_Option' ][ ] = $option; |
|
385 | + public function add_temp_option(EE_Question_Option $option) { |
|
386 | + $this->_model_relations['Question_Option'][] = $option; |
|
387 | 387 | return TRUE; |
388 | 388 | } |
389 | 389 | |
@@ -394,8 +394,8 @@ discard block |
||
394 | 394 | * @param EE_Question_Option $option |
395 | 395 | * @return boolean success |
396 | 396 | */ |
397 | - public function remove_option( EE_Question_Option $option ) { |
|
398 | - return $this->_remove_relation_to( $option, 'Question_Option' ); |
|
397 | + public function remove_option(EE_Question_Option $option) { |
|
398 | + return $this->_remove_relation_to($option, 'Question_Option'); |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | |
@@ -404,8 +404,8 @@ discard block |
||
404 | 404 | * @return bool |
405 | 405 | */ |
406 | 406 | public function is_system_question() { |
407 | - $system_ID = $this->get( 'QST_system' ); |
|
408 | - return ! empty( $system_ID ) ? TRUE : FALSE; |
|
407 | + $system_ID = $this->get('QST_system'); |
|
408 | + return ! empty($system_ID) ? TRUE : FALSE; |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | */ |
419 | 419 | public function set_order_to_latest() { |
420 | 420 | $latest_order = $this->get_model()->get_latest_question_order(); |
421 | - $latest_order ++; |
|
422 | - $this->set( 'QST_order', $latest_order ); |
|
421 | + $latest_order++; |
|
422 | + $this->set('QST_order', $latest_order); |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | |
@@ -438,20 +438,20 @@ discard block |
||
438 | 438 | * Duplicates this question and its question options |
439 | 439 | * @return \EE_Question |
440 | 440 | */ |
441 | - public function duplicate( $options = array() ) { |
|
441 | + public function duplicate($options = array()) { |
|
442 | 442 | $new_question = clone $this; |
443 | - $new_question->set( 'QST_ID', null ); |
|
444 | - $new_question->set_display_text( sprintf( __( '%s **Duplicate**', 'event_espresso' ), $this->display_text() ) ); |
|
445 | - $new_question->set_admin_label( sprintf( __( '%s **Duplicate**', 'event_espresso' ), $this->admin_label() ) ); |
|
446 | - $new_question->set_system_ID( null ); |
|
447 | - $new_question->set_wp_user( get_current_user_id() ); |
|
443 | + $new_question->set('QST_ID', null); |
|
444 | + $new_question->set_display_text(sprintf(__('%s **Duplicate**', 'event_espresso'), $this->display_text())); |
|
445 | + $new_question->set_admin_label(sprintf(__('%s **Duplicate**', 'event_espresso'), $this->admin_label())); |
|
446 | + $new_question->set_system_ID(null); |
|
447 | + $new_question->set_wp_user(get_current_user_id()); |
|
448 | 448 | //if we're duplicating a trashed question, assume we don't want the new one to be trashed |
449 | - $new_question->set_deleted( false ); |
|
449 | + $new_question->set_deleted(false); |
|
450 | 450 | $success = $new_question->save(); |
451 | - if( $success ) { |
|
451 | + if ($success) { |
|
452 | 452 | //we don't totally want to duplicate the question options, because we want them to be for the NEW question |
453 | - foreach( $this->options() as $question_option ) { |
|
454 | - $question_option->duplicate( array( 'QST_ID' => $new_question->ID() ) ); |
|
453 | + foreach ($this->options() as $question_option) { |
|
454 | + $question_option->duplicate(array('QST_ID' => $new_question->ID())); |
|
455 | 455 | } |
456 | 456 | return $new_question; |
457 | 457 | } else { |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * @return int|float |
465 | 465 | */ |
466 | 466 | public function max() { |
467 | - return $this->get( 'QST_max' ); |
|
467 | + return $this->get('QST_max'); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | /** |
@@ -472,8 +472,8 @@ discard block |
||
472 | 472 | * @param int|float $new_max |
473 | 473 | * @return void |
474 | 474 | */ |
475 | - public function set_max( $new_max ) { |
|
476 | - $this->set( 'QST_max', $new_max ); |
|
475 | + public function set_max($new_max) { |
|
476 | + $this->set('QST_max', $new_max); |
|
477 | 477 | } |
478 | 478 | |
479 | 479 | |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * @param array $input_constructor_args |
486 | 486 | * @return EE_Form_Input_Base |
487 | 487 | */ |
488 | - public function generate_form_input( $registration = null, $answer = null, $input_constructor_args = array() ) { |
|
488 | + public function generate_form_input($registration = null, $answer = null, $input_constructor_args = array()) { |
|
489 | 489 | $identifier = $this->is_system_question() ? $this->system_ID() : $this->ID(); |
490 | 490 | |
491 | 491 | $input_constructor_args = array_merge( |
@@ -496,29 +496,29 @@ discard block |
||
496 | 496 | ), |
497 | 497 | $input_constructor_args |
498 | 498 | ); |
499 | - if( ! $answer instanceof EE_Answer && $registration instanceof EE_Registration ) { |
|
500 | - $answer = EEM_Answer::instance()->get_registration_question_answer_object( $registration, $this->ID() ); |
|
499 | + if ( ! $answer instanceof EE_Answer && $registration instanceof EE_Registration) { |
|
500 | + $answer = EEM_Answer::instance()->get_registration_question_answer_object($registration, $this->ID()); |
|
501 | 501 | } |
502 | 502 | // has this question been answered ? |
503 | - if ( $answer instanceof EE_Answer |
|
503 | + if ($answer instanceof EE_Answer |
|
504 | 504 | && $answer->value() !== '' |
505 | 505 | ) { |
506 | 506 | //answer gets htmlspecialchars called on it, undo that please |
507 | 507 | //because the form input's display strategy may call esc_attr too |
508 | 508 | //which also does html special characters |
509 | 509 | $values_with_html_special_chars = $answer->value(); |
510 | - if( is_array( $values_with_html_special_chars ) ) { |
|
511 | - $default_value = array_map( 'htmlspecialchars_decode', $values_with_html_special_chars ); |
|
510 | + if (is_array($values_with_html_special_chars)) { |
|
511 | + $default_value = array_map('htmlspecialchars_decode', $values_with_html_special_chars); |
|
512 | 512 | } else { |
513 | - $default_value = htmlspecialchars_decode( $values_with_html_special_chars ); |
|
513 | + $default_value = htmlspecialchars_decode($values_with_html_special_chars); |
|
514 | 514 | } |
515 | 515 | $input_constructor_args['default'] = $default_value; |
516 | 516 | } |
517 | - $max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question( $this->system_ID() ); |
|
518 | - if( EEM_Question::instance()->question_type_is_in_category( $this->type(), 'text' ) ) { |
|
519 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Max_Length_Validation_Strategy( |
|
517 | + $max_max_for_question = EEM_Question::instance()->absolute_max_for_system_question($this->system_ID()); |
|
518 | + if (EEM_Question::instance()->question_type_is_in_category($this->type(), 'text')) { |
|
519 | + $input_constructor_args['validation_strategies'][] = new EE_Max_Length_Validation_Strategy( |
|
520 | 520 | null, |
521 | - min( $max_max_for_question, $this->max() ) |
|
521 | + min($max_max_for_question, $this->max()) |
|
522 | 522 | ); |
523 | 523 | } |
524 | 524 | $input_constructor_args = apply_filters( |
@@ -530,22 +530,22 @@ discard block |
||
530 | 530 | ); |
531 | 531 | |
532 | 532 | $result = null; |
533 | - switch ( $this->type() ) { |
|
533 | + switch ($this->type()) { |
|
534 | 534 | // Text |
535 | 535 | case EEM_Question::QST_type_text : |
536 | - $result = new EE_Text_Input( $input_constructor_args ); |
|
536 | + $result = new EE_Text_Input($input_constructor_args); |
|
537 | 537 | break; |
538 | 538 | // Textarea |
539 | 539 | case EEM_Question::QST_type_textarea : |
540 | - $result = new EE_Text_Area_Input( $input_constructor_args ); |
|
540 | + $result = new EE_Text_Area_Input($input_constructor_args); |
|
541 | 541 | break; |
542 | 542 | // Radio Buttons |
543 | 543 | case EEM_Question::QST_type_radio : |
544 | - $result = new EE_Radio_Button_Input( $this->options(), $input_constructor_args ); |
|
544 | + $result = new EE_Radio_Button_Input($this->options(), $input_constructor_args); |
|
545 | 545 | break; |
546 | 546 | // Dropdown |
547 | 547 | case EEM_Question::QST_type_dropdown : |
548 | - $result = new EE_Select_Input( $this->options(), $input_constructor_args ); |
|
548 | + $result = new EE_Select_Input($this->options(), $input_constructor_args); |
|
549 | 549 | break; |
550 | 550 | // State Dropdown |
551 | 551 | case EEM_Question::QST_type_state : |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | $registration, |
557 | 557 | $answer |
558 | 558 | ); |
559 | - $result = new EE_State_Select_Input( $state_options, $input_constructor_args ); |
|
559 | + $result = new EE_State_Select_Input($state_options, $input_constructor_args); |
|
560 | 560 | break; |
561 | 561 | // Country Dropdown |
562 | 562 | case EEM_Question::QST_type_country : |
@@ -567,47 +567,47 @@ discard block |
||
567 | 567 | $registration, |
568 | 568 | $answer |
569 | 569 | ); |
570 | - $result = new EE_Country_Select_Input( $country_options, $input_constructor_args ); |
|
570 | + $result = new EE_Country_Select_Input($country_options, $input_constructor_args); |
|
571 | 571 | break; |
572 | 572 | // Checkboxes |
573 | 573 | case EEM_Question::QST_type_checkbox : |
574 | - $result = new EE_Checkbox_Multi_Input( $this->options(), $input_constructor_args ); |
|
574 | + $result = new EE_Checkbox_Multi_Input($this->options(), $input_constructor_args); |
|
575 | 575 | break; |
576 | 576 | // Date |
577 | 577 | case EEM_Question::QST_type_date : |
578 | - $result = new EE_Datepicker_Input( $input_constructor_args ); |
|
578 | + $result = new EE_Datepicker_Input($input_constructor_args); |
|
579 | 579 | break; |
580 | 580 | case EEM_Question::QST_type_html_textarea : |
581 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_Simple_HTML_Validation_Strategy(); |
|
582 | - $result = new EE_Text_Area_Input( $input_constructor_args ); |
|
583 | - $result->remove_validation_strategy( 'EE_Plaintext_Validation_Strategy' ); |
|
581 | + $input_constructor_args['validation_strategies'][] = new EE_Simple_HTML_Validation_Strategy(); |
|
582 | + $result = new EE_Text_Area_Input($input_constructor_args); |
|
583 | + $result->remove_validation_strategy('EE_Plaintext_Validation_Strategy'); |
|
584 | 584 | break; |
585 | 585 | case EEM_Question::QST_type_email : |
586 | - $result = new EE_Email_Input( $input_constructor_args ); |
|
586 | + $result = new EE_Email_Input($input_constructor_args); |
|
587 | 587 | break; |
588 | 588 | case EEM_Question::QST_type_us_phone : |
589 | - $result = new EE_Phone_Input( $input_constructor_args ); |
|
589 | + $result = new EE_Phone_Input($input_constructor_args); |
|
590 | 590 | break; |
591 | 591 | case EEM_Question::QST_type_int : |
592 | - $result = new EE_Integer_Input( $input_constructor_args ); |
|
592 | + $result = new EE_Integer_Input($input_constructor_args); |
|
593 | 593 | break; |
594 | 594 | case EEM_Question::QST_type_decimal : |
595 | - $result = new EE_Float_Input( $input_constructor_args ); |
|
595 | + $result = new EE_Float_Input($input_constructor_args); |
|
596 | 596 | break; |
597 | 597 | case EEM_Question::QST_type_url : |
598 | - $input_constructor_args[ 'validation_strategies' ][] = new EE_URL_Validation_Strategy(); |
|
599 | - $result = new EE_Text_Input( $input_constructor_args ); |
|
598 | + $input_constructor_args['validation_strategies'][] = new EE_URL_Validation_Strategy(); |
|
599 | + $result = new EE_Text_Input($input_constructor_args); |
|
600 | 600 | break; |
601 | 601 | case EEM_Question::QST_type_year : |
602 | 602 | $result = new EE_Year_Input( |
603 | 603 | $input_constructor_args, |
604 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__year_question__four_digit', true, $this ), |
|
605 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__year_question__early_range', 100, $this ), |
|
606 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__year_question__end_range', 100, $this ) |
|
604 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__year_question__four_digit', true, $this), |
|
605 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__year_question__early_range', 100, $this), |
|
606 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Attendee_Information___generate_question_input__year_question__end_range', 100, $this) |
|
607 | 607 | ); |
608 | 608 | break; |
609 | 609 | case EEM_Question::QST_type_multi_select : |
610 | - $result = new EE_Select_Multiple_Input( $this->options(), $input_constructor_args ); |
|
610 | + $result = new EE_Select_Multiple_Input($this->options(), $input_constructor_args); |
|
611 | 611 | break; |
612 | 612 | // fallback |
613 | 613 | default : |
@@ -618,12 +618,12 @@ discard block |
||
618 | 618 | $this, |
619 | 619 | $input_constructor_args |
620 | 620 | ); |
621 | - if( ! $default_input ){ |
|
622 | - $default_input = new EE_Text_Input( $input_constructor_args ); |
|
621 | + if ( ! $default_input) { |
|
622 | + $default_input = new EE_Text_Input($input_constructor_args); |
|
623 | 623 | } |
624 | 624 | $result = $default_input; |
625 | 625 | } |
626 | - return apply_filters( 'FHEE__EE_Question__generate_form_input__return', $result, $registration, $this, $answer ); |
|
626 | + return apply_filters('FHEE__EE_Question__generate_form_input__return', $result, $registration, $this, $answer); |
|
627 | 627 | } |
628 | 628 | |
629 | 629 |
@@ -445,8 +445,8 @@ discard block |
||
445 | 445 | $new_question->set_admin_label( sprintf( __( '%s **Duplicate**', 'event_espresso' ), $this->admin_label() ) ); |
446 | 446 | $new_question->set_system_ID( null ); |
447 | 447 | $new_question->set_wp_user( get_current_user_id() ); |
448 | - //if we're duplicating a trashed question, assume we don't want the new one to be trashed |
|
449 | - $new_question->set_deleted( false ); |
|
448 | + //if we're duplicating a trashed question, assume we don't want the new one to be trashed |
|
449 | + $new_question->set_deleted( false ); |
|
450 | 450 | $success = $new_question->save(); |
451 | 451 | if( $success ) { |
452 | 452 | //we don't totally want to duplicate the question options, because we want them to be for the NEW question |
@@ -501,8 +501,8 @@ discard block |
||
501 | 501 | } |
502 | 502 | // has this question been answered ? |
503 | 503 | if ( $answer instanceof EE_Answer |
504 | - && $answer->value() !== '' |
|
505 | - ) { |
|
504 | + && $answer->value() !== '' |
|
505 | + ) { |
|
506 | 506 | //answer gets htmlspecialchars called on it, undo that please |
507 | 507 | //because the form input's display strategy may call esc_attr too |
508 | 508 | //which also does html special characters |
@@ -628,17 +628,17 @@ discard block |
||
628 | 628 | |
629 | 629 | |
630 | 630 | |
631 | - /** |
|
632 | - * Returns whether or not this question type should have question option entries |
|
633 | - * @return bool |
|
634 | - */ |
|
631 | + /** |
|
632 | + * Returns whether or not this question type should have question option entries |
|
633 | + * @return bool |
|
634 | + */ |
|
635 | 635 | public function should_have_question_options() |
636 | - { |
|
637 | - return in_array( |
|
638 | - $this->type(), |
|
639 | - $this->_model->question_types_with_options(), |
|
640 | - true |
|
641 | - ); |
|
642 | - } |
|
636 | + { |
|
637 | + return in_array( |
|
638 | + $this->type(), |
|
639 | + $this->_model->question_types_with_options(), |
|
640 | + true |
|
641 | + ); |
|
642 | + } |
|
643 | 643 | |
644 | 644 | } |