@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @author Mike Nelson |
15 | 15 | * |
16 | 16 | */ |
17 | -class EE_Restriction_Generator_Meta extends EE_Restriction_Generator_Base{ |
|
17 | +class EE_Restriction_Generator_Meta extends EE_Restriction_Generator_Base { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | * @param string $key_field_name |
34 | 34 | * @param string $value_field_name |
35 | 35 | */ |
36 | - public function __construct( $key_field_name, $value_field_name ) { |
|
36 | + public function __construct($key_field_name, $value_field_name) { |
|
37 | 37 | $this->_key_field_name = $key_field_name; |
38 | 38 | $this->_value_field_name = $value_field_name; |
39 | 39 | } |
@@ -45,21 +45,21 @@ discard block |
||
45 | 45 | * @throws EE_Error |
46 | 46 | */ |
47 | 47 | protected function _generate_restrictions() { |
48 | - $whitelisted_meta_keys = apply_filters( 'FHEE__EE_Restriction_Generator_Meta___generate_restrictions__whitelisted_meta_keys', array() ); |
|
49 | - $blacklisted_meta_keys = apply_filters( 'FHEE__EE_Restriction_Generator_Meta___generate_restrictions__blacklisted_meta_keys', array() ); |
|
48 | + $whitelisted_meta_keys = apply_filters('FHEE__EE_Restriction_Generator_Meta___generate_restrictions__whitelisted_meta_keys', array()); |
|
49 | + $blacklisted_meta_keys = apply_filters('FHEE__EE_Restriction_Generator_Meta___generate_restrictions__blacklisted_meta_keys', array()); |
|
50 | 50 | $conditions = array( |
51 | - $this->_key_field_name => array( 'NOT_LIKE', "\\\\_%" ),//each slash is escaped because we are using double quotes, and |
|
51 | + $this->_key_field_name => array('NOT_LIKE', "\\\\_%"), //each slash is escaped because we are using double quotes, and |
|
52 | 52 | //stripslashes will be called on this because the models assume this is from user input |
53 | - $this->_value_field_name => array( 'NOT_REGEXP', '^[aOs]:[\d]:.*$') |
|
53 | + $this->_value_field_name => array('NOT_REGEXP', '^[aOs]:[\d]:.*$') |
|
54 | 54 | ); |
55 | - if( ! empty( $blacklisted_meta_keys ) ) { |
|
56 | - $conditions[ $this->_key_field_name . '*blacklisted' ] = array( 'NOT_IN', $blacklisted_meta_keys ); |
|
55 | + if ( ! empty($blacklisted_meta_keys)) { |
|
56 | + $conditions[$this->_key_field_name.'*blacklisted'] = array('NOT_IN', $blacklisted_meta_keys); |
|
57 | 57 | } |
58 | - if( ! empty( $whitelisted_meta_keys ) ) { |
|
58 | + if ( ! empty($whitelisted_meta_keys)) { |
|
59 | 59 | $conditions = array( |
60 | 60 | 'OR*whitelisted-or-normal' => array( |
61 | 61 | 'AND' => $conditions, |
62 | - $this->_key_field_name . '*whitelisted' => array( 'IN', $whitelisted_meta_keys ) |
|
62 | + $this->_key_field_name.'*whitelisted' => array('IN', $whitelisted_meta_keys) |
|
63 | 63 | ) |
64 | 64 | ); |
65 | 65 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | //only allow access to non-protected metas if they're an admin |
68 | 68 | EE_Restriction_Generator_Base::get_default_restrictions_cap() => new EE_Return_None_Where_Conditions(), |
69 | 69 | //don't allow access to protected metas to anyone. If they want that, don't apply caps to the query |
70 | - 'apply-to-all-queries-using-caps' => new EE_Default_Where_Conditions( $conditions ), |
|
70 | + 'apply-to-all-queries-using-caps' => new EE_Default_Where_Conditions($conditions), |
|
71 | 71 | ); |
72 | 72 | } |
73 | 73 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | <?php _e('Adjust the settings for the PayPal Standard payment gateway.', 'event_espresso'); ?> |
4 | 4 | </p> |
5 | 5 | <p> |
6 | -<?php printf( __( 'See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso' ), "<a href='https://www.paypal.com/multicurrency' target='_blank'>","</a>" ); ?> |
|
6 | +<?php printf(__('See %1$shere%2$s for list of currencies supported by Paypal Standard.', 'event_espresso'), "<a href='https://www.paypal.com/multicurrency' target='_blank'>", "</a>"); ?> |
|
7 | 7 | </p> |
8 | 8 | <h3><?php _e('PayPal Standard Settings', 'event_espresso'); ?></h3> |
9 | 9 | <ul> |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | </li> |
22 | 22 | <li> |
23 | 23 | <strong><?php _e('PayPal Calculates Taxes', 'event_espresso'); ?></strong><br /> |
24 | -<?php printf( __('If set to "Yes", we will indicate to PayPal that it should calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>' ); ?><br/> |
|
25 | -<?php _e( 'Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso' );?> |
|
24 | +<?php printf(__('If set to "Yes", we will indicate to PayPal that it should calculate the taxes on the order and add it. This means PayPal\'s tax calculations will be used on the order instead of Event Espresso\'s. %1$sRead here for more information.%2$s', 'event_espresso'), "<a href='https://www.paypal.com/ca/cgi-bin/webscr?cmd=xpt/Marketing/shipping/EasyCalculateShipAndTax-outside' target='_blank'>", '</a>'); ?><br/> |
|
25 | +<?php _e('Note: It may confuse users if Event Espresso initially calculates taxes on the order, and then they go to PayPal and it calculates taxes differently. So it is recommended that if PayPal is calculating taxes, that you do not set any taxes in Event Espresso.', 'event_espresso'); ?> |
|
26 | 26 | </li> |
27 | 27 | <li> |
28 | 28 | <strong><?php _e('PayPal Calculates Shipping', 'event_espresso'); ?></strong><br /> |
29 | 29 | <?php _e('Similar to the "PayPal Calculates Taxes" setting, if this is set to "Yes", we will indicate to PayPal that it should calculate the shipping on each payment (if there are multiple payments for a single transaction, PayPal is permitted to add shipping charges to each payment.)', 'event_espresso'); ?><br/> |
30 | -<?php _e( 'Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso' );?> |
|
30 | +<?php _e('Important Note: PayPal will ONLY calculate shipping on an order if "Shipping Address Options" is set to "Prompt for an Address" (otherwise how will PayPal know how much to charge for shipping if it doesn\'t know where it\'s shipping to?)', 'event_espresso'); ?> |
|
31 | 31 | <li> |
32 | -<strong><?php _e( 'Notes Regarding Paypal Taxes and Shipping', 'event_espresso' );?></strong><br/> |
|
33 | -<?php _e( 'If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso' );?><br/> |
|
34 | -<?php _e( 'However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso' );?><br/> |
|
35 | -<?php _e( 'Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso' );?> |
|
32 | +<strong><?php _e('Notes Regarding Paypal Taxes and Shipping', 'event_espresso'); ?></strong><br/> |
|
33 | +<?php _e('If you want PayPal to calculate taxes and shipping on an order, those changes will NOT appear during the initial registration process until the user is redirected to PayPal for payment.', 'event_espresso'); ?><br/> |
|
34 | +<?php _e('However, after the user has returned from PayPal, their order in Event Espresso will be updated with the new taxes and added shipping charges (e.g. it will appear on their receipt.)', 'event_espresso'); ?><br/> |
|
35 | +<?php _e('Also Note: In order for PayPal to properly calculate taxes and shipping, they need to receive the entire order at the same time. So if a user goes to make a payment using PayPal, and their order somehow already has a payment on it, PayPal CANNOT calculate taxes or shipping on that order.', 'event_espresso'); ?> |
|
36 | 36 | </li> |
37 | 37 | <li> |
38 | 38 | <strong><?php _e('Shipping Address Options', 'event_espresso'); ?></strong><br /> |
@@ -126,7 +126,7 @@ |
||
126 | 126 | * being address info, and 0 being neither) |
127 | 127 | * @global type $wpdb |
128 | 128 | * @param type $new_question_group_id |
129 | - * @return boolean |
|
129 | + * @return integer |
|
130 | 130 | */ |
131 | 131 | private function _is_system_question_group($new_question_group_id){ |
132 | 132 | global $wpdb; |
@@ -487,12 +487,12 @@ discard block |
||
487 | 487 | } |
488 | 488 | } |
489 | 489 | |
490 | - }elseif( !empty($this->_req_data['QSG_ID'])){ |
|
490 | + } elseif( !empty($this->_req_data['QSG_ID'])){ |
|
491 | 491 | $success = $this->_delete_item( $this->_req_data['QSG_ID'], $model ); |
492 | 492 | |
493 | - }elseif( !empty($this->_req_data['QST_ID'])){ |
|
493 | + } elseif( !empty($this->_req_data['QST_ID'])){ |
|
494 | 494 | $success = $this->_delete_item( $this->_req_data['QST_ID'], $model ); |
495 | - }else{ |
|
495 | + } else{ |
|
496 | 496 | EE_Error::add_error( sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ ); |
497 | 497 | } |
498 | 498 | return $success; |
@@ -531,7 +531,7 @@ discard block |
||
531 | 531 | $questionGroup=$this->_question_group_model->get_one_by_ID( $ID); |
532 | 532 | $additional_hidden_fields=array('QSG_ID'=>array('type'=>'hidden','value'=>$ID)); |
533 | 533 | $this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields); |
534 | - }else{ |
|
534 | + } else{ |
|
535 | 535 | /** @var EE_Question_Group $questionGroup */ |
536 | 536 | $questionGroup = EEM_Question_Group::instance()->create_default_object(); |
537 | 537 | $questionGroup->set_order_to_latest(); |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | if($trash){ |
735 | 735 | $action_desc = 'trashed'; |
736 | 736 | $status = 'trash'; |
737 | - }else{ |
|
737 | + } else{ |
|
738 | 738 | $action_desc = 'restored'; |
739 | 739 | $status = 'all'; |
740 | 740 | } |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
757 | 757 | $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
758 | 758 | $results=$this->_question_model->count_deleted($where); |
759 | - }else{ |
|
759 | + } else{ |
|
760 | 760 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
761 | 761 | $results=$this->_question_model->get_all_deleted($query_params); |
762 | 762 | } |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | if ($count){ |
778 | 778 | $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
779 | 779 | $results = $questionGroupModel->count($where); |
780 | - }else{ |
|
780 | + } else{ |
|
781 | 781 | $results = $questionGroupModel->get_all($query_params); |
782 | 782 | } |
783 | 783 | return $results; |
@@ -798,7 +798,7 @@ discard block |
||
798 | 798 | $where = isset( $query_params[0] ) ? array($query_params[0]) : array(); |
799 | 799 | $query_params['limit'] = NULL; |
800 | 800 | $results = $questionGroupModel->count_deleted($where); |
801 | - }else{ |
|
801 | + } else{ |
|
802 | 802 | $results = $questionGroupModel->get_all_deleted($query_params); |
803 | 803 | } |
804 | 804 | return $results; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ){ |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | } |
5 | 5 | /** |
@@ -36,13 +36,13 @@ discard block |
||
36 | 36 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
37 | 37 | * @access public |
38 | 38 | */ |
39 | - public function __construct( $routing = TRUE ) { |
|
40 | - define( 'REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND . 'registration_form' . DS ); |
|
41 | - define( 'REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN . 'assets' . DS ); |
|
42 | - define( 'REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/assets/' ); |
|
43 | - define( 'REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN . 'templates' . DS ); |
|
44 | - define( 'REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL . 'registration_form/templates/' ); |
|
45 | - parent::__construct( $routing ); |
|
39 | + public function __construct($routing = TRUE) { |
|
40 | + define('REGISTRATION_FORM_CAF_ADMIN', EE_CORE_CAF_ADMIN_EXTEND.'registration_form'.DS); |
|
41 | + define('REGISTRATION_FORM_CAF_ASSETS_PATH', REGISTRATION_FORM_CAF_ADMIN.'assets'.DS); |
|
42 | + define('REGISTRATION_FORM_CAF_ASSETS_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/assets/'); |
|
43 | + define('REGISTRATION_FORM_CAF_TEMPLATE_PATH', REGISTRATION_FORM_CAF_ADMIN.'templates'.DS); |
|
44 | + define('REGISTRATION_FORM_CAF_TEMPLATE_URL', EE_CORE_CAF_ADMIN_EXTEND_URL.'registration_form/templates/'); |
|
45 | + parent::__construct($routing); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | |
53 | 53 | protected function _extend_page_config() { |
54 | 54 | $this->_admin_base_path = REGISTRATION_FORM_CAF_ADMIN; |
55 | - $qst_id = ! empty( $this->_req_data['QST_ID'] ) && ! is_array( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0; |
|
56 | - $qsg_id = ! empty( $this->_req_data['QSG_ID'] ) && ! is_array( $this->_req_data['QSG_ID'] ) ? $this->_req_data['QSG_ID'] : 0; |
|
55 | + $qst_id = ! empty($this->_req_data['QST_ID']) && ! is_array($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0; |
|
56 | + $qsg_id = ! empty($this->_req_data['QSG_ID']) && ! is_array($this->_req_data['QSG_ID']) ? $this->_req_data['QSG_ID'] : 0; |
|
57 | 57 | |
58 | 58 | $new_page_routes = array( |
59 | 59 | 'question_groups' => array( |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | 'func' => '_trash_or_restore_questions', |
87 | 87 | 'capability' => 'ee_delete_question', |
88 | 88 | 'obj_id' => $qst_id, |
89 | - 'args' => array( 'trash' => FALSE ), |
|
89 | + 'args' => array('trash' => FALSE), |
|
90 | 90 | 'noheader' => TRUE |
91 | 91 | ), |
92 | 92 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | 'trash_question_group' => array( |
147 | 147 | 'func' => '_trash_or_restore_question_groups', |
148 | - 'args' => array( 'trash' => TRUE ), |
|
148 | + 'args' => array('trash' => TRUE), |
|
149 | 149 | 'capability' => 'ee_delete_question_group', |
150 | 150 | 'obj_id' => $qsg_id, |
151 | 151 | 'noheader' => TRUE |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | 'restore_question_group' => array( |
155 | 155 | 'func' => '_trash_or_restore_question_groups', |
156 | - 'args' => array( 'trash' => FALSE ), |
|
156 | + 'args' => array('trash' => FALSE), |
|
157 | 157 | 'capability' => 'ee_delete_question_group', |
158 | 158 | 'obj_id' => $qsg_id, |
159 | 159 | 'noheader' => TRUE |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | 'update_question_group' => array( |
170 | 170 | 'func' => '_insert_or_update_question_group', |
171 | - 'args' => array('new_question_group' => FALSE ), |
|
171 | + 'args' => array('new_question_group' => FALSE), |
|
172 | 172 | 'capability' => 'ee_edit_question_group', |
173 | 173 | 'obj_id' => $qsg_id, |
174 | 174 | 'noheader' => TRUE, |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | 'noheader' => TRUE |
207 | 207 | ), |
208 | 208 | ); |
209 | - $this->_page_routes = array_merge( $this->_page_routes, $new_page_routes ); |
|
209 | + $this->_page_routes = array_merge($this->_page_routes, $new_page_routes); |
|
210 | 210 | |
211 | 211 | $new_page_config = array( |
212 | 212 | |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | 'filename' => 'registration_form_question_groups_views_bulk_actions_search' |
231 | 231 | ), |
232 | 232 | ), |
233 | - 'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'), |
|
233 | + 'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'), |
|
234 | 234 | 'metaboxes' => $this->_default_espresso_metaboxes, |
235 | 235 | 'require_nonce' => FALSE, |
236 | 236 | 'qtips' => array( |
@@ -244,14 +244,14 @@ discard block |
||
244 | 244 | 'order' => 5, |
245 | 245 | 'persistent' => FALSE |
246 | 246 | ), |
247 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
247 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
248 | 248 | 'help_tabs' => array( |
249 | 249 | 'registration_form_add_question_help_tab' => array( |
250 | 250 | 'title' => __('Add Question', 'event_espresso'), |
251 | 251 | 'filename' => 'registration_form_add_question' |
252 | 252 | ), |
253 | 253 | ), |
254 | - 'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'), |
|
254 | + 'help_tour' => array('Registration_Form_Add_Question_Help_Tour'), |
|
255 | 255 | 'require_nonce' => FALSE |
256 | 256 | ), |
257 | 257 | |
@@ -261,14 +261,14 @@ discard block |
||
261 | 261 | 'order' => 5, |
262 | 262 | 'persistent' => FALSE |
263 | 263 | ), |
264 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
264 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
265 | 265 | 'help_tabs' => array( |
266 | 266 | 'registration_form_add_question_group_help_tab' => array( |
267 | 267 | 'title' => __('Add Question Group', 'event_espresso'), |
268 | 268 | 'filename' => 'registration_form_add_question_group' |
269 | 269 | ), |
270 | 270 | ), |
271 | - 'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'), |
|
271 | + 'help_tour' => array('Registration_Form_Add_Question_Group_Help_Tour'), |
|
272 | 272 | 'require_nonce' => FALSE |
273 | 273 | ), |
274 | 274 | |
@@ -277,16 +277,16 @@ discard block |
||
277 | 277 | 'label' => __('Edit Question Group', 'event_espresso'), |
278 | 278 | 'order' => 5, |
279 | 279 | 'persistent' => FALSE, |
280 | - 'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
280 | + 'url' => isset($this->_req_data['question_group_id']) ? add_query_arg(array('question_group_id' => $this->_req_data['question_group_id']), $this->_current_page_view_url) : $this->_admin_base_url |
|
281 | 281 | ), |
282 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
282 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
283 | 283 | 'help_tabs' => array( |
284 | 284 | 'registration_form_edit_question_group_help_tab' => array( |
285 | 285 | 'title' => __('Edit Question Group', 'event_espresso'), |
286 | 286 | 'filename' => 'registration_form_edit_question_group' |
287 | 287 | ), |
288 | 288 | ), |
289 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'), |
|
289 | + 'help_tour' => array('Registration_Form_Edit_Question_Group_Help_Tour'), |
|
290 | 290 | 'require_nonce' => FALSE |
291 | 291 | ), |
292 | 292 | |
@@ -298,19 +298,19 @@ discard block |
||
298 | 298 | 'labels' => array( |
299 | 299 | 'publishbox' => __('Update Settings', 'event_espresso') |
300 | 300 | ), |
301 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array( '_publish_post_box' ) ), |
|
301 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
302 | 302 | 'help_tabs' => array( |
303 | 303 | 'registration_form_reg_form_settings_help_tab' => array( |
304 | 304 | 'title' => __('Registration Form Settings', 'event_espresso'), |
305 | 305 | 'filename' => 'registration_form_reg_form_settings' |
306 | 306 | ), |
307 | 307 | ), |
308 | - 'help_tour' => array( 'Registration_Form_Settings_Help_Tour'), |
|
308 | + 'help_tour' => array('Registration_Form_Settings_Help_Tour'), |
|
309 | 309 | 'require_nonce' => FALSE |
310 | 310 | ) |
311 | 311 | |
312 | 312 | ); |
313 | - $this->_page_config = array_merge( $this->_page_config, $new_page_config ); |
|
313 | + $this->_page_config = array_merge($this->_page_config, $new_page_config); |
|
314 | 314 | |
315 | 315 | //change the list table we're going to use so it's the NEW list table! |
316 | 316 | $this->_page_config['default']['list_table'] = 'Extend_Registration_Form_Questions_Admin_List_Table'; |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | 'edit_question_group' => __('Edit Question Group', 'event_espresso'), |
325 | 325 | 'delete_question_group' => __('Delete Question Group', 'event_espresso'), |
326 | 326 | ); |
327 | - $this->_labels['buttons'] = array_merge( $this->_labels['buttons'], $new_labels ); |
|
327 | + $this->_labels['buttons'] = array_merge($this->_labels['buttons'], $new_labels); |
|
328 | 328 | |
329 | 329 | } |
330 | 330 | |
@@ -333,14 +333,14 @@ discard block |
||
333 | 333 | |
334 | 334 | |
335 | 335 | protected function _ajax_hooks() { |
336 | - add_action('wp_ajax_espresso_update_question_group_order', array( $this, 'update_question_group_order' )); |
|
336 | + add_action('wp_ajax_espresso_update_question_group_order', array($this, 'update_question_group_order')); |
|
337 | 337 | } |
338 | 338 | |
339 | 339 | |
340 | 340 | |
341 | 341 | |
342 | 342 | public function load_scripts_styles_question_groups() { |
343 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
343 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | * @return void |
362 | 362 | */ |
363 | 363 | public function load_sortable_question_script() { |
364 | - wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL . 'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true); |
|
364 | + wp_register_script('ee-question-sortable', REGISTRATION_FORM_CAF_ASSETS_URL.'ee_question_order.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, true); |
|
365 | 365 | wp_enqueue_script('ee-question-sortable'); |
366 | 366 | } |
367 | 367 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | ) |
381 | 381 | ); |
382 | 382 | |
383 | - if ( EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) { |
|
383 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) { |
|
384 | 384 | $this->_views['trash'] = array( |
385 | 385 | 'slug' => 'trash', |
386 | 386 | 'label' => __('Trash', 'event_espresso'), |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | ) |
411 | 411 | ); |
412 | 412 | |
413 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_question_groups', 'espresso_registration_form_trash_question_groups' ) ) { |
|
413 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_question_groups', 'espresso_registration_form_trash_question_groups')) { |
|
414 | 414 | $this->_views['trash'] = array( |
415 | 415 | 'slug' => 'trash', |
416 | 416 | 'label' => __('Trash', 'event_espresso'), |
@@ -446,24 +446,24 @@ discard block |
||
446 | 446 | |
447 | 447 | |
448 | 448 | |
449 | - protected function _delete_question(){ |
|
450 | - $success = $this->_delete_items( $this->_question_model ); |
|
449 | + protected function _delete_question() { |
|
450 | + $success = $this->_delete_items($this->_question_model); |
|
451 | 451 | $this->_redirect_after_action( |
452 | 452 | $success, |
453 | - $this->_question_model->item_name( $success ), |
|
453 | + $this->_question_model->item_name($success), |
|
454 | 454 | 'deleted', |
455 | - array( 'action' => 'default', 'status' => 'all' ) |
|
455 | + array('action' => 'default', 'status' => 'all') |
|
456 | 456 | ); |
457 | 457 | } |
458 | 458 | |
459 | 459 | |
460 | 460 | protected function _delete_questions() { |
461 | - $success = $this->_delete_items( $this->_question_model ); |
|
461 | + $success = $this->_delete_items($this->_question_model); |
|
462 | 462 | $this->_redirect_after_action( |
463 | 463 | $success, |
464 | - $this->_question_model->item_name( $success ), |
|
464 | + $this->_question_model->item_name($success), |
|
465 | 465 | 'deleted permanently', |
466 | - array( 'action' => 'default', 'status' => 'trash' ) |
|
466 | + array('action' => 'default', 'status' => 'trash') |
|
467 | 467 | ); |
468 | 468 | } |
469 | 469 | |
@@ -474,26 +474,26 @@ discard block |
||
474 | 474 | * @param EEM_Soft_Delete_Base $model |
475 | 475 | * @return int number of items deleted permanently |
476 | 476 | */ |
477 | - private function _delete_items(EEM_Soft_Delete_Base $model){ |
|
477 | + private function _delete_items(EEM_Soft_Delete_Base $model) { |
|
478 | 478 | $success = 0; |
479 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
480 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
479 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
480 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
481 | 481 | // if array has more than one element than success message should be plural |
482 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
482 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
483 | 483 | // cycle thru bulk action checkboxes |
484 | - while (list( $ID, $value ) = each($this->_req_data['checkbox'])) { |
|
485 | - if ( ! $this->_delete_item( $ID, $model ) ) { |
|
484 | + while (list($ID, $value) = each($this->_req_data['checkbox'])) { |
|
485 | + if ( ! $this->_delete_item($ID, $model)) { |
|
486 | 486 | $success = 0; |
487 | 487 | } |
488 | 488 | } |
489 | 489 | |
490 | - }elseif( !empty($this->_req_data['QSG_ID'])){ |
|
491 | - $success = $this->_delete_item( $this->_req_data['QSG_ID'], $model ); |
|
490 | + }elseif ( ! empty($this->_req_data['QSG_ID'])) { |
|
491 | + $success = $this->_delete_item($this->_req_data['QSG_ID'], $model); |
|
492 | 492 | |
493 | - }elseif( !empty($this->_req_data['QST_ID'])){ |
|
494 | - $success = $this->_delete_item( $this->_req_data['QST_ID'], $model ); |
|
495 | - }else{ |
|
496 | - EE_Error::add_error( sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__ ); |
|
493 | + }elseif ( ! empty($this->_req_data['QST_ID'])) { |
|
494 | + $success = $this->_delete_item($this->_req_data['QST_ID'], $model); |
|
495 | + } else { |
|
496 | + EE_Error::add_error(sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__); |
|
497 | 497 | } |
498 | 498 | return $success; |
499 | 499 | } |
@@ -504,11 +504,11 @@ discard block |
||
504 | 504 | * @param EEM_Soft_Delete_Base $model |
505 | 505 | * @return boolean |
506 | 506 | */ |
507 | - protected function _delete_item( $id, $model ) { |
|
508 | - if( $model instanceof EEM_Question ) { |
|
509 | - EEM_Question_Option::instance()->delete_permanently( array( array( 'QST_ID' => absint( $id ) ) ) ); |
|
507 | + protected function _delete_item($id, $model) { |
|
508 | + if ($model instanceof EEM_Question) { |
|
509 | + EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id)))); |
|
510 | 510 | } |
511 | - return $model->delete_permanently_by_ID( absint( $id ) ); |
|
511 | + return $model->delete_permanently_by_ID(absint($id)); |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | |
@@ -520,31 +520,31 @@ discard block |
||
520 | 520 | |
521 | 521 | |
522 | 522 | |
523 | - protected function _edit_question_group( $type = 'add' ) { |
|
524 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
525 | - $ID=isset( $this->_req_data['QSG_ID'] ) && ! empty( $this->_req_data['QSG_ID'] ) ? absint( $this->_req_data['QSG_ID'] ) : FALSE; |
|
526 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
523 | + protected function _edit_question_group($type = 'add') { |
|
524 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
525 | + $ID = isset($this->_req_data['QSG_ID']) && ! empty($this->_req_data['QSG_ID']) ? absint($this->_req_data['QSG_ID']) : FALSE; |
|
526 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
527 | 527 | // add ID to title if editing |
528 | - $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title; |
|
529 | - if($ID){ |
|
528 | + $this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title; |
|
529 | + if ($ID) { |
|
530 | 530 | /** @var EE_Question_Group $questionGroup */ |
531 | - $questionGroup=$this->_question_group_model->get_one_by_ID( $ID); |
|
532 | - $additional_hidden_fields=array('QSG_ID'=>array('type'=>'hidden','value'=>$ID)); |
|
531 | + $questionGroup = $this->_question_group_model->get_one_by_ID($ID); |
|
532 | + $additional_hidden_fields = array('QSG_ID'=>array('type'=>'hidden', 'value'=>$ID)); |
|
533 | 533 | $this->_set_add_edit_form_tags('update_question_group', $additional_hidden_fields); |
534 | - }else{ |
|
534 | + } else { |
|
535 | 535 | /** @var EE_Question_Group $questionGroup */ |
536 | 536 | $questionGroup = EEM_Question_Group::instance()->create_default_object(); |
537 | 537 | $questionGroup->set_order_to_latest(); |
538 | 538 | $this->_set_add_edit_form_tags('insert_question_group'); |
539 | 539 | } |
540 | 540 | $this->_template_args['values'] = $this->_yes_no_values; |
541 | - $this->_template_args['all_questions']=$questionGroup->questions_in_and_not_in_group(); |
|
542 | - $this->_template_args['QSG_ID']=$ID ? $ID : TRUE; |
|
543 | - $this->_template_args['question_group']=$questionGroup; |
|
541 | + $this->_template_args['all_questions'] = $questionGroup->questions_in_and_not_in_group(); |
|
542 | + $this->_template_args['QSG_ID'] = $ID ? $ID : TRUE; |
|
543 | + $this->_template_args['question_group'] = $questionGroup; |
|
544 | 544 | |
545 | - $redirect_URL = add_query_arg( array( 'action' => 'question_groups'), $this->_admin_base_url ); |
|
546 | - $this->_set_publish_post_box_vars( 'id', $ID, FALSE, $redirect_URL ); |
|
547 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'question_groups_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
545 | + $redirect_URL = add_query_arg(array('action' => 'question_groups'), $this->_admin_base_url); |
|
546 | + $this->_set_publish_post_box_vars('id', $ID, FALSE, $redirect_URL); |
|
547 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_CAF_TEMPLATE_PATH.'question_groups_main_meta_box.template.php', $this->_template_args, TRUE); |
|
548 | 548 | |
549 | 549 | // the details template wrapper |
550 | 550 | $this->display_admin_page_with_sidebar(); |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | |
556 | 556 | protected function _delete_question_groups() { |
557 | 557 | $success = $this->_delete_items($this->_question_group_model); |
558 | - $this->_redirect_after_action( $success, $this->_question_group_model->item_name($success), 'deleted permanently', array( 'action'=>'question_groups', 'status'=>'trash' )); |
|
558 | + $this->_redirect_after_action($success, $this->_question_group_model->item_name($success), 'deleted permanently', array('action'=>'question_groups', 'status'=>'trash')); |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | |
@@ -563,71 +563,71 @@ discard block |
||
563 | 563 | /** |
564 | 564 | * @param bool $new_question_group |
565 | 565 | */ |
566 | - protected function _insert_or_update_question_group( $new_question_group = TRUE) { |
|
567 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
568 | - $set_column_values=$this->_set_column_values_for($this->_question_group_model); |
|
569 | - if ( $new_question_group ){ |
|
566 | + protected function _insert_or_update_question_group($new_question_group = TRUE) { |
|
567 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
568 | + $set_column_values = $this->_set_column_values_for($this->_question_group_model); |
|
569 | + if ($new_question_group) { |
|
570 | 570 | $QSG_ID = $this->_question_group_model->insert($set_column_values); |
571 | 571 | $success = $QSG_ID ? 1 : 0; |
572 | 572 | } else { |
573 | 573 | $QSG_ID = absint($this->_req_data['QSG_ID']); |
574 | - unset( $set_column_values[ 'QSG_ID' ] ); |
|
575 | - $success= $this->_question_group_model->update( $set_column_values, array( array( 'QSG_ID' => $QSG_ID ))); |
|
574 | + unset($set_column_values['QSG_ID']); |
|
575 | + $success = $this->_question_group_model->update($set_column_values, array(array('QSG_ID' => $QSG_ID))); |
|
576 | 576 | } |
577 | - $phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string( EEM_Attendee::system_question_phone ); |
|
577 | + $phone_question_id = EEM_Question::instance()->get_Question_ID_from_system_string(EEM_Attendee::system_question_phone); |
|
578 | 578 | // update the existing related questions |
579 | 579 | // BUT FIRST... delete the phone question from the Question_Group_Question if it is being added to this question group (therefore removed from the existing group) |
580 | - if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $phone_question_id ] )) { |
|
580 | + if (isset($this->_req_data['questions'], $this->_req_data['questions'][$phone_question_id])) { |
|
581 | 581 | // delete where QST ID = system phone question ID and Question Group ID is NOT this group |
582 | - EEM_Question_Group_Question::instance()->delete( array( array( 'QST_ID' => $phone_question_id, 'QSG_ID' => array( '!=', $QSG_ID )))); |
|
582 | + EEM_Question_Group_Question::instance()->delete(array(array('QST_ID' => $phone_question_id, 'QSG_ID' => array('!=', $QSG_ID)))); |
|
583 | 583 | } |
584 | 584 | /** @type EE_Question_Group $question_group */ |
585 | - $question_group=$this->_question_group_model->get_one_by_ID( $QSG_ID ); |
|
585 | + $question_group = $this->_question_group_model->get_one_by_ID($QSG_ID); |
|
586 | 586 | $questions = $question_group->questions(); |
587 | 587 | // make sure system phone question is added to list of questions for this group |
588 | - if ( ! isset( $questions[$phone_question_id ] )) { |
|
589 | - $questions[ $phone_question_id ] = EEM_Question::instance()->get_one_by_ID( $phone_question_id ); |
|
588 | + if ( ! isset($questions[$phone_question_id])) { |
|
589 | + $questions[$phone_question_id] = EEM_Question::instance()->get_one_by_ID($phone_question_id); |
|
590 | 590 | } |
591 | 591 | |
592 | - foreach( $questions as $question_ID => $question ){ |
|
592 | + foreach ($questions as $question_ID => $question) { |
|
593 | 593 | // first we always check for order. |
594 | - if ( ! empty( $this->_req_data['question_orders'][ $question_ID ] ) ){ |
|
594 | + if ( ! empty($this->_req_data['question_orders'][$question_ID])) { |
|
595 | 595 | //update question order |
596 | - $question_group->update_question_order( $question_ID, $this->_req_data['question_orders'][ $question_ID ] ); |
|
596 | + $question_group->update_question_order($question_ID, $this->_req_data['question_orders'][$question_ID]); |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | // then we always check if adding or removing. |
600 | - if ( isset( $this->_req_data['questions'], $this->_req_data['questions'][ $question_ID ] )) { |
|
601 | - $question_group->add_question( $question_ID ); |
|
600 | + if (isset($this->_req_data['questions'], $this->_req_data['questions'][$question_ID])) { |
|
601 | + $question_group->add_question($question_ID); |
|
602 | 602 | } else { |
603 | 603 | // not found, remove it (but only if not a system question for the personal group with the exception of lname system question - we allow removal of it) |
604 | 604 | if ( |
605 | 605 | in_array( |
606 | 606 | $question->system_ID(), |
607 | - EEM_Question::instance()->required_system_questions_in_system_question_group( $question_group->system_group() ) |
|
607 | + EEM_Question::instance()->required_system_questions_in_system_question_group($question_group->system_group()) |
|
608 | 608 | ) |
609 | 609 | ) { |
610 | 610 | continue; |
611 | 611 | } else { |
612 | - $question_group->remove_question( $question_ID ); |
|
612 | + $question_group->remove_question($question_ID); |
|
613 | 613 | } |
614 | 614 | } |
615 | 615 | } |
616 | 616 | // save new related questions |
617 | - if ( isset( $this->_req_data['questions'] )) { |
|
618 | - foreach( $this->_req_data['questions'] as $QST_ID ){ |
|
619 | - $question_group->add_question( $QST_ID ); |
|
620 | - if ( isset( $this->_req_data['question_orders'][ $QST_ID ] )) { |
|
621 | - $question_group->update_question_order( $QST_ID, $this->_req_data['question_orders'][ $QST_ID ] ); |
|
617 | + if (isset($this->_req_data['questions'])) { |
|
618 | + foreach ($this->_req_data['questions'] as $QST_ID) { |
|
619 | + $question_group->add_question($QST_ID); |
|
620 | + if (isset($this->_req_data['question_orders'][$QST_ID])) { |
|
621 | + $question_group->update_question_order($QST_ID, $this->_req_data['question_orders'][$QST_ID]); |
|
622 | 622 | } |
623 | 623 | } |
624 | 624 | } |
625 | 625 | |
626 | - if ( $success !== FALSE ) { |
|
627 | - $msg = $new_question_group ? sprintf( __('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name() ) : sprintf( __('The %s has been updated', 'event_espresso' ), $this->_question_group_model->item_name() ); |
|
628 | - EE_Error::add_success( $msg ); |
|
626 | + if ($success !== FALSE) { |
|
627 | + $msg = $new_question_group ? sprintf(__('The %s has been created', 'event_espresso'), $this->_question_group_model->item_name()) : sprintf(__('The %s has been updated', 'event_espresso'), $this->_question_group_model->item_name()); |
|
628 | + EE_Error::add_success($msg); |
|
629 | 629 | } |
630 | - $this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group','QSG_ID'=>$QSG_ID), TRUE); |
|
630 | + $this->_redirect_after_action(FALSE, '', '', array('action'=>'edit_question_group', 'QSG_ID'=>$QSG_ID), TRUE); |
|
631 | 631 | |
632 | 632 | } |
633 | 633 | |
@@ -635,20 +635,20 @@ discard block |
||
635 | 635 | * duplicates a question and all its question options and redirects to the new question. |
636 | 636 | */ |
637 | 637 | public function _duplicate_question() { |
638 | - $question_ID = (int)$this->_req_data[ 'QST_ID' ]; |
|
639 | - $question = EEM_Question::instance()->get_one_by_ID( $question_ID ); |
|
640 | - if( $question instanceof EE_Question ) { |
|
638 | + $question_ID = (int) $this->_req_data['QST_ID']; |
|
639 | + $question = EEM_Question::instance()->get_one_by_ID($question_ID); |
|
640 | + if ($question instanceof EE_Question) { |
|
641 | 641 | $new_question = $question->duplicate(); |
642 | - if( $new_question instanceof EE_Question ) { |
|
643 | - $this->_redirect_after_action( true, __( 'Question', 'event_espresso' ), __( 'Duplicated', 'event_espresso' ), array('action'=>'edit_question', 'QST_ID' => $new_question->ID() ), TRUE); |
|
642 | + if ($new_question instanceof EE_Question) { |
|
643 | + $this->_redirect_after_action(true, __('Question', 'event_espresso'), __('Duplicated', 'event_espresso'), array('action'=>'edit_question', 'QST_ID' => $new_question->ID()), TRUE); |
|
644 | 644 | } else { |
645 | 645 | global $wpdb; |
646 | - EE_Error::add_error( sprintf( __( 'Could not duplicate question with ID %1$d because: %2$s', 'event_espresso' ), $question_ID, $wpdb->last_error ), __FILE__, __FUNCTION__, __LINE__ ); |
|
647 | - $this->_redirect_after_action(false, '', '', array('action'=>'default'), false ); |
|
646 | + EE_Error::add_error(sprintf(__('Could not duplicate question with ID %1$d because: %2$s', 'event_espresso'), $question_ID, $wpdb->last_error), __FILE__, __FUNCTION__, __LINE__); |
|
647 | + $this->_redirect_after_action(false, '', '', array('action'=>'default'), false); |
|
648 | 648 | } |
649 | 649 | } else { |
650 | - EE_Error::add_error( sprintf( __( 'Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso' ), $question_ID ), __FILE__, __FUNCTION__, __LINE__ ); |
|
651 | - $this->_redirect_after_action( false, '', '', array( 'action' => 'default' ), false ); |
|
650 | + EE_Error::add_error(sprintf(__('Could not duplicate question with ID %d because it didn\'t exist!', 'event_espresso'), $question_ID), __FILE__, __FUNCTION__, __LINE__); |
|
651 | + $this->_redirect_after_action(false, '', '', array('action' => 'default'), false); |
|
652 | 652 | } |
653 | 653 | } |
654 | 654 | |
@@ -657,8 +657,8 @@ discard block |
||
657 | 657 | /** |
658 | 658 | * @param bool $trash |
659 | 659 | */ |
660 | - protected function _trash_or_restore_question_groups( $trash = TRUE) { |
|
661 | - $this->_trash_or_restore_items( $this->_question_group_model, $trash ); |
|
660 | + protected function _trash_or_restore_question_groups($trash = TRUE) { |
|
661 | + $this->_trash_or_restore_items($this->_question_group_model, $trash); |
|
662 | 662 | } |
663 | 663 | |
664 | 664 | |
@@ -666,9 +666,9 @@ discard block |
||
666 | 666 | /** |
667 | 667 | *_trash_question |
668 | 668 | */ |
669 | - protected function _trash_question(){ |
|
670 | - $success=$this->_question_model->delete_by_ID( (int)$this->_req_data['QST_ID'] ); |
|
671 | - $query_args=array('action'=>'default','status'=>'all'); |
|
669 | + protected function _trash_question() { |
|
670 | + $success = $this->_question_model->delete_by_ID((int) $this->_req_data['QST_ID']); |
|
671 | + $query_args = array('action'=>'default', 'status'=>'all'); |
|
672 | 672 | $this->_redirect_after_action($success, $this->_question_model->item_name($success), 'trashed', $query_args); |
673 | 673 | } |
674 | 674 | |
@@ -677,8 +677,8 @@ discard block |
||
677 | 677 | /** |
678 | 678 | * @param bool $trash |
679 | 679 | */ |
680 | - protected function _trash_or_restore_questions( $trash=TRUE){ |
|
681 | - $this->_trash_or_restore_items( $this->_question_model, $trash ); |
|
680 | + protected function _trash_or_restore_questions($trash = TRUE) { |
|
681 | + $this->_trash_or_restore_items($this->_question_model, $trash); |
|
682 | 682 | } |
683 | 683 | |
684 | 684 | |
@@ -690,21 +690,21 @@ discard block |
||
690 | 690 | *@param EEM_Soft_Delete_Base $model |
691 | 691 | * @param boolean $trash whether to trash or restore |
692 | 692 | */ |
693 | - private function _trash_or_restore_items( EEM_Soft_Delete_Base $model, $trash = TRUE ) { |
|
693 | + private function _trash_or_restore_items(EEM_Soft_Delete_Base $model, $trash = TRUE) { |
|
694 | 694 | |
695 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
695 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
696 | 696 | |
697 | 697 | $success = 1; |
698 | 698 | //Checkboxes |
699 | 699 | //echo "trash $trash"; |
700 | 700 | //var_dump($this->_req_data['checkbox']);die; |
701 | - if ( isset( $this->_req_data['checkbox'] )) { |
|
702 | - if ( ! empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] )) { |
|
701 | + if (isset($this->_req_data['checkbox'])) { |
|
702 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
703 | 703 | // if array has more than one element than success message should be plural |
704 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
704 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
705 | 705 | // cycle thru bulk action checkboxes |
706 | - while (list( $ID, $value ) = each($this->_req_data['checkbox'])) { |
|
707 | - if ( ! $model->delete_or_restore_by_ID($trash,absint($ID))) { |
|
706 | + while (list($ID, $value) = each($this->_req_data['checkbox'])) { |
|
707 | + if ( ! $model->delete_or_restore_by_ID($trash, absint($ID))) { |
|
708 | 708 | $success = 0; |
709 | 709 | } |
710 | 710 | } |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | } else { |
713 | 713 | // grab single id and delete |
714 | 714 | $ID = absint($this->_req_data['checkbox']); |
715 | - if ( ! $model->delete_or_restore_by_ID($trash,$ID)) { |
|
715 | + if ( ! $model->delete_or_restore_by_ID($trash, $ID)) { |
|
716 | 716 | $success = 0; |
717 | 717 | } |
718 | 718 | } |
@@ -720,25 +720,25 @@ discard block |
||
720 | 720 | } else { |
721 | 721 | // delete via trash link |
722 | 722 | // grab single id and delete |
723 | - $ID = absint($this->_req_data[ $model->primary_key_name() ]); |
|
724 | - if ( ! $model->delete_or_restore_by_ID($trash,$ID)) { |
|
723 | + $ID = absint($this->_req_data[$model->primary_key_name()]); |
|
724 | + if ( ! $model->delete_or_restore_by_ID($trash, $ID)) { |
|
725 | 725 | $success = 0; |
726 | 726 | } |
727 | 727 | |
728 | 728 | } |
729 | 729 | |
730 | 730 | |
731 | - $action = $model instanceof EEM_Question ? 'default' : 'question_groups';//strtolower( $model->item_name(2) ); |
|
731 | + $action = $model instanceof EEM_Question ? 'default' : 'question_groups'; //strtolower( $model->item_name(2) ); |
|
732 | 732 | //echo "action :$action"; |
733 | 733 | //$action = 'questions' ? 'default' : $action; |
734 | - if($trash){ |
|
734 | + if ($trash) { |
|
735 | 735 | $action_desc = 'trashed'; |
736 | 736 | $status = 'trash'; |
737 | - }else{ |
|
737 | + } else { |
|
738 | 738 | $action_desc = 'restored'; |
739 | 739 | $status = 'all'; |
740 | 740 | } |
741 | - $this->_redirect_after_action( $success, $model->item_name($success), $action_desc, array( 'action' => $action, 'status'=>$status ) ); |
|
741 | + $this->_redirect_after_action($success, $model->item_name($success), $action_desc, array('action' => $action, 'status'=>$status)); |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | |
@@ -749,16 +749,16 @@ discard block |
||
749 | 749 | * @param bool|false $count |
750 | 750 | * @return \EE_Soft_Delete_Base_Class[]|int |
751 | 751 | */ |
752 | - public function get_trashed_questions( $per_page, $current_page = 1, $count = FALSE ) { |
|
752 | + public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) { |
|
753 | 753 | $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page); |
754 | 754 | |
755 | - if( $count ){ |
|
755 | + if ($count) { |
|
756 | 756 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
757 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
758 | - $results=$this->_question_model->count_deleted($where); |
|
759 | - }else{ |
|
757 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
758 | + $results = $this->_question_model->count_deleted($where); |
|
759 | + } else { |
|
760 | 760 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
761 | - $results=$this->_question_model->get_all_deleted($query_params); |
|
761 | + $results = $this->_question_model->get_all_deleted($query_params); |
|
762 | 762 | } |
763 | 763 | return $results; |
764 | 764 | } |
@@ -771,13 +771,13 @@ discard block |
||
771 | 771 | * @param bool|false $count |
772 | 772 | * @return \EE_Soft_Delete_Base_Class[] |
773 | 773 | */ |
774 | - public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) { |
|
775 | - $questionGroupModel=EEM_Question_Group::instance(); |
|
776 | - $query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page); |
|
777 | - if ($count){ |
|
778 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
774 | + public function get_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
775 | + $questionGroupModel = EEM_Question_Group::instance(); |
|
776 | + $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page); |
|
777 | + if ($count) { |
|
778 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
779 | 779 | $results = $questionGroupModel->count($where); |
780 | - }else{ |
|
780 | + } else { |
|
781 | 781 | $results = $questionGroupModel->get_all($query_params); |
782 | 782 | } |
783 | 783 | return $results; |
@@ -791,14 +791,14 @@ discard block |
||
791 | 791 | * @param bool $count |
792 | 792 | * @return \EE_Soft_Delete_Base_Class[]|int |
793 | 793 | */ |
794 | - public function get_trashed_question_groups( $per_page, $current_page = 1, $count = FALSE ) { |
|
795 | - $questionGroupModel=EEM_Question_Group::instance(); |
|
796 | - $query_params=$this->get_query_params($questionGroupModel,$per_page,$current_page); |
|
797 | - if($count){ |
|
798 | - $where = isset( $query_params[0] ) ? array($query_params[0]) : array(); |
|
794 | + public function get_trashed_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
795 | + $questionGroupModel = EEM_Question_Group::instance(); |
|
796 | + $query_params = $this->get_query_params($questionGroupModel, $per_page, $current_page); |
|
797 | + if ($count) { |
|
798 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
799 | 799 | $query_params['limit'] = NULL; |
800 | 800 | $results = $questionGroupModel->count_deleted($where); |
801 | - }else{ |
|
801 | + } else { |
|
802 | 802 | $results = $questionGroupModel->get_all_deleted($query_params); |
803 | 803 | } |
804 | 804 | return $results; |
@@ -811,32 +811,32 @@ discard block |
||
811 | 811 | */ |
812 | 812 | public function update_question_group_order() { |
813 | 813 | |
814 | - $success = __( 'Question group order was updated successfully.', 'event_espresso' ); |
|
814 | + $success = __('Question group order was updated successfully.', 'event_espresso'); |
|
815 | 815 | |
816 | 816 | // grab our row IDs |
817 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) |
|
818 | - ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) |
|
817 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) |
|
818 | + ? explode(',', rtrim($this->_req_data['row_ids'], ',')) |
|
819 | 819 | : array(); |
820 | 820 | |
821 | - $perpage = !empty( $this->_req_data['perpage'] ) |
|
821 | + $perpage = ! empty($this->_req_data['perpage']) |
|
822 | 822 | ? (int) $this->_req_data['perpage'] |
823 | 823 | : NULL; |
824 | - $curpage = !empty( $this->_req_data['curpage'] ) |
|
824 | + $curpage = ! empty($this->_req_data['curpage']) |
|
825 | 825 | ? (int) $this->_req_data['curpage'] |
826 | 826 | : NULL; |
827 | 827 | |
828 | - if ( ! empty( $row_ids ) ) { |
|
828 | + if ( ! empty($row_ids)) { |
|
829 | 829 | //figure out where we start the row_id count at for the current page. |
830 | - $qsgcount = empty( $curpage ) ? 0 : ($curpage - 1 ) * $perpage; |
|
830 | + $qsgcount = empty($curpage) ? 0 : ($curpage - 1) * $perpage; |
|
831 | 831 | |
832 | - $row_count = count( $row_ids ); |
|
833 | - for( $i = 0; $i < $row_count; $i++ ) { |
|
832 | + $row_count = count($row_ids); |
|
833 | + for ($i = 0; $i < $row_count; $i++) { |
|
834 | 834 | //Update the questions when re-ordering |
835 | 835 | $updated = EEM_Question_Group::instance()->update( |
836 | - array( 'QSG_order' => $qsgcount ), |
|
837 | - array( array( 'QSG_ID' => $row_ids[ $i ] ) ) |
|
836 | + array('QSG_order' => $qsgcount), |
|
837 | + array(array('QSG_ID' => $row_ids[$i])) |
|
838 | 838 | ); |
839 | - if ( $updated === false ) { |
|
839 | + if ($updated === false) { |
|
840 | 840 | $success = false; |
841 | 841 | } |
842 | 842 | $qsgcount++; |
@@ -846,10 +846,10 @@ discard block |
||
846 | 846 | } |
847 | 847 | |
848 | 848 | $errors = ! $success |
849 | - ? __( 'An error occurred. The question group order was not updated.', 'event_espresso' ) |
|
849 | + ? __('An error occurred. The question group order was not updated.', 'event_espresso') |
|
850 | 850 | : false; |
851 | 851 | |
852 | - echo json_encode( array( 'return_data' => false, 'success' => $success, 'errors' => $errors )); |
|
852 | + echo json_encode(array('return_data' => false, 'success' => $success, 'errors' => $errors)); |
|
853 | 853 | die(); |
854 | 854 | |
855 | 855 | } |
@@ -868,17 +868,17 @@ discard block |
||
868 | 868 | $this->_template_args['values'] = $this->_yes_no_values; |
869 | 869 | add_action( |
870 | 870 | 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
871 | - array( $this, 'email_validation_settings_form' ), |
|
871 | + array($this, 'email_validation_settings_form'), |
|
872 | 872 | 2 |
873 | 873 | ); |
874 | - $this->_template_args = (array)apply_filters( |
|
874 | + $this->_template_args = (array) apply_filters( |
|
875 | 875 | 'FHEE__Extend_Registration_Form_Admin_Page___reg_form_settings___template_args', |
876 | 876 | $this->_template_args |
877 | 877 | ); |
878 | - $this->_set_add_edit_form_tags( 'update_reg_form_settings' ); |
|
879 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
878 | + $this->_set_add_edit_form_tags('update_reg_form_settings'); |
|
879 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
880 | 880 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
881 | - REGISTRATION_FORM_CAF_TEMPLATE_PATH . 'reg_form_settings.template.php', |
|
881 | + REGISTRATION_FORM_CAF_TEMPLATE_PATH.'reg_form_settings.template.php', |
|
882 | 882 | $this->_template_args, |
883 | 883 | TRUE |
884 | 884 | ); |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | EE_Registry::instance()->CFG, |
900 | 900 | __FILE__, __FUNCTION__, __LINE__ |
901 | 901 | ); |
902 | - $this->_redirect_after_action( $success, __('Registration Form Options', 'event_espresso'), 'updated', array( 'action' => 'view_reg_form_settings' ) ); |
|
902 | + $this->_redirect_after_action($success, __('Registration Form Options', 'event_espresso'), 'updated', array('action' => 'view_reg_form_settings')); |
|
903 | 903 | } |
904 | 904 | |
905 | 905 | |
@@ -930,20 +930,20 @@ discard block |
||
930 | 930 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
931 | 931 | 'subsections' => array( |
932 | 932 | 'email_validation_hdr' => new EE_Form_Section_HTML( |
933 | - EEH_HTML::h2( __( 'Email Validation Settings', 'event_espresso' ) ) |
|
933 | + EEH_HTML::h2(__('Email Validation Settings', 'event_espresso')) |
|
934 | 934 | ), |
935 | 935 | 'email_validation_level' => new EE_Select_Input( |
936 | 936 | array( |
937 | - 'basic' => __( 'Basic', 'event_espresso' ), |
|
938 | - 'wp_default' => __( 'WordPress Default', 'event_espresso' ), |
|
939 | - 'i18n' => __( 'International', 'event_espresso' ), |
|
940 | - 'i18n_dns' => __( 'International + DNS Check', 'event_espresso' ), |
|
937 | + 'basic' => __('Basic', 'event_espresso'), |
|
938 | + 'wp_default' => __('WordPress Default', 'event_espresso'), |
|
939 | + 'i18n' => __('International', 'event_espresso'), |
|
940 | + 'i18n_dns' => __('International + DNS Check', 'event_espresso'), |
|
941 | 941 | ), |
942 | 942 | array( |
943 | - 'html_label_text' => __( 'Email Validation Level', 'event_espresso' ) |
|
944 | - . EEH_Template::get_help_tab_link( 'email_validation_info' ), |
|
945 | - 'html_help_text' => __( 'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'), |
|
946 | - 'default' => isset( EE_Registry::instance()->CFG->registration->email_validation_level ) |
|
943 | + 'html_label_text' => __('Email Validation Level', 'event_espresso') |
|
944 | + . EEH_Template::get_help_tab_link('email_validation_info'), |
|
945 | + 'html_help_text' => __('These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'), |
|
946 | + 'default' => isset(EE_Registry::instance()->CFG->registration->email_validation_level) |
|
947 | 947 | ? EE_Registry::instance()->CFG->registration->email_validation_level |
948 | 948 | : 'wp_default', |
949 | 949 | 'required' => false |
@@ -962,18 +962,18 @@ discard block |
||
962 | 962 | * @param \EE_Registration_Config $EE_Registration_Config |
963 | 963 | * @return \EE_Registration_Config |
964 | 964 | */ |
965 | - public function update_email_validation_settings_form( EE_Registration_Config $EE_Registration_Config ) { |
|
965 | + public function update_email_validation_settings_form(EE_Registration_Config $EE_Registration_Config) { |
|
966 | 966 | try { |
967 | 967 | $email_validation_settings_form = $this->_email_validation_settings_form(); |
968 | 968 | // if not displaying a form, then check for form submission |
969 | - if ( $email_validation_settings_form->was_submitted() ) { |
|
969 | + if ($email_validation_settings_form->was_submitted()) { |
|
970 | 970 | // capture form data |
971 | 971 | $email_validation_settings_form->receive_form_submission(); |
972 | 972 | // validate form data |
973 | - if ( $email_validation_settings_form->is_valid() ) { |
|
973 | + if ($email_validation_settings_form->is_valid()) { |
|
974 | 974 | // grab validated data from form |
975 | 975 | $valid_data = $email_validation_settings_form->valid_data(); |
976 | - if ( isset( $valid_data['email_validation_level'] ) ) { |
|
976 | + if (isset($valid_data['email_validation_level'])) { |
|
977 | 977 | $EE_Registration_Config->email_validation_level = $valid_data['email_validation_level']; |
978 | 978 | } else { |
979 | 979 | EE_Error::add_error( |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | ); |
988 | 988 | } |
989 | 989 | } else { |
990 | - if ( $email_validation_settings_form->submission_error_message() !== '' ) { |
|
990 | + if ($email_validation_settings_form->submission_error_message() !== '') { |
|
991 | 991 | EE_Error::add_error( |
992 | 992 | $email_validation_settings_form->submission_error_message(), |
993 | 993 | __FILE__, |
@@ -997,7 +997,7 @@ discard block |
||
997 | 997 | } |
998 | 998 | } |
999 | 999 | } |
1000 | - } catch ( EE_Error $e ) { |
|
1000 | + } catch (EE_Error $e) { |
|
1001 | 1001 | $e->get_error(); |
1002 | 1002 | } |
1003 | 1003 | return $EE_Registration_Config; |
@@ -245,13 +245,13 @@ discard block |
||
245 | 245 | 'persistent' => FALSE |
246 | 246 | ), |
247 | 247 | 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
248 | - 'help_tabs' => array( |
|
248 | + 'help_tabs' => array( |
|
249 | 249 | 'registration_form_add_question_help_tab' => array( |
250 | 250 | 'title' => __('Add Question', 'event_espresso'), |
251 | 251 | 'filename' => 'registration_form_add_question' |
252 | 252 | ), |
253 | 253 | ), |
254 | - 'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'), |
|
254 | + 'help_tour' => array( 'Registration_Form_Add_Question_Help_Tour'), |
|
255 | 255 | 'require_nonce' => FALSE |
256 | 256 | ), |
257 | 257 | |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | 'filename' => 'registration_form_add_question_group' |
269 | 269 | ), |
270 | 270 | ), |
271 | - 'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'), |
|
271 | + 'help_tour' => array( 'Registration_Form_Add_Question_Group_Help_Tour'), |
|
272 | 272 | 'require_nonce' => FALSE |
273 | 273 | ), |
274 | 274 | |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | 'filename' => 'registration_form_edit_question_group' |
287 | 287 | ), |
288 | 288 | ), |
289 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'), |
|
289 | + 'help_tour' => array( 'Registration_Form_Edit_Question_Group_Help_Tour'), |
|
290 | 290 | 'require_nonce' => FALSE |
291 | 291 | ), |
292 | 292 | |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | 'filename' => 'registration_form_reg_form_settings' |
306 | 306 | ), |
307 | 307 | ), |
308 | - 'help_tour' => array( 'Registration_Form_Settings_Help_Tour'), |
|
308 | + 'help_tour' => array( 'Registration_Form_Settings_Help_Tour'), |
|
309 | 309 | 'require_nonce' => FALSE |
310 | 310 | ) |
311 | 311 | |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | ), |
942 | 942 | array( |
943 | 943 | 'html_label_text' => __( 'Email Validation Level', 'event_espresso' ) |
944 | - . EEH_Template::get_help_tab_link( 'email_validation_info' ), |
|
944 | + . EEH_Template::get_help_tab_link( 'email_validation_info' ), |
|
945 | 945 | 'html_help_text' => __( 'These levels range from basic validation ( ie: [email protected] ) to more advanced checks against international email addresses (ie: üñîçøðé@example.com ) with additional MX and A record checks to confirm the domain actually exists. More information on on each level can be found within the help section.', 'event_espresso'), |
946 | 946 | 'default' => isset( EE_Registry::instance()->CFG->registration->email_validation_level ) |
947 | 947 | ? EE_Registry::instance()->CFG->registration->email_validation_level |
@@ -3,18 +3,18 @@ |
||
3 | 3 | * Field to only allow tags that are normally allowed on post_content: |
4 | 4 | * address,a,abbr,acronym,area,article,aside,b,big,blockquote,br,button,caption,cite,code,col,del,dd,dfn,details,div,dl,dt,em,fieldset,figure,figcaption,font,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,img,ins,kbd,label,legend,li,map,mark,menu,nav,p,pre,q,s,samp,span,section,small,strike,strong,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,u,ul,ol,var |
5 | 5 | */ |
6 | -class EE_Post_Content_Field extends EE_Full_HTML_Field{ |
|
6 | +class EE_Post_Content_Field extends EE_Full_HTML_Field { |
|
7 | 7 | /** |
8 | 8 | * removes all tags which a WP Post wouldn't allow in its content normally |
9 | 9 | * @param string $value_inputted_for_field_on_model_object |
10 | 10 | * @return string |
11 | 11 | */ |
12 | 12 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
13 | - $value_with_select_tags = wp_kses("$value_inputted_for_field_on_model_object",wp_kses_allowed_html( 'post' )); |
|
13 | + $value_with_select_tags = wp_kses("$value_inputted_for_field_on_model_object", wp_kses_allowed_html('post')); |
|
14 | 14 | return parent::prepare_for_set($value_with_select_tags); |
15 | 15 | } |
16 | 16 | |
17 | - function prepare_for_set_from_db($value_found_in_db_for_model_object){ |
|
17 | + function prepare_for_set_from_db($value_found_in_db_for_model_object) { |
|
18 | 18 | return $value_found_in_db_for_model_object; |
19 | 19 | } |
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * Class EE_Line_Item_Filter_Collection |
@@ -7,6 +7,10 @@ discard block |
||
7 | 7 | |
8 | 8 | protected $_post_type; |
9 | 9 | protected $_meta_field; |
10 | + |
|
11 | + /** |
|
12 | + * @param string $post_type |
|
13 | + */ |
|
10 | 14 | function __construct($post_type, $meta_field_to_chk = ''){ |
11 | 15 | $this->_post_type = $post_type; |
12 | 16 | $this->_meta_field = $meta_field_to_chk; |
@@ -27,7 +31,6 @@ discard block |
||
27 | 31 | } |
28 | 32 | /** |
29 | 33 | * Gets the where default where conditions for a custom post type model |
30 | - * @param string $model_relation_path. Eg, from Event to Payment, this should be "Registration.Transaction.Payment" |
|
31 | 34 | * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions) |
32 | 35 | */ |
33 | 36 | protected function _get_default_where_conditions() { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | * @since 4.8.29.rc.010 |
16 | 16 | * |
17 | 17 | */ |
18 | -class EE_CPT_Minimum_Where_Conditions extends EE_Default_Where_Conditions{ |
|
18 | +class EE_CPT_Minimum_Where_Conditions extends EE_Default_Where_Conditions { |
|
19 | 19 | |
20 | 20 | protected $_post_type; |
21 | 21 | protected $_meta_field; |
22 | - function __construct($post_type, $meta_field_to_chk = ''){ |
|
22 | + function __construct($post_type, $meta_field_to_chk = '') { |
|
23 | 23 | $this->_post_type = $post_type; |
24 | 24 | $this->_meta_field = $meta_field_to_chk; |
25 | 25 | } |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | * @param string $column column name |
30 | 30 | * @return EE_Model_Field_Base |
31 | 31 | */ |
32 | - protected function _get_field_on_column($column){ |
|
32 | + protected function _get_field_on_column($column) { |
|
33 | 33 | $all_fields = $this->_model->field_settings(true); |
34 | - foreach($all_fields as $field_name => $field_obj){ |
|
35 | - if($column == $field_obj->get_table_column()){ |
|
34 | + foreach ($all_fields as $field_name => $field_obj) { |
|
35 | + if ($column == $field_obj->get_table_column()) { |
|
36 | 36 | return $field_obj; |
37 | 37 | } |
38 | 38 | } |
@@ -5,7 +5,7 @@ |
||
5 | 5 | /** |
6 | 6 | * |
7 | 7 | * Class EE_CPT_Minimum_Where_Conditions |
8 | - * |
|
8 | + * |
|
9 | 9 | * Strategy specifically for adding where conditions specific to CPT models. |
10 | 10 | * But only sets the minimum, so any row of the right type will get used |
11 | 11 | * |
@@ -17,7 +17,6 @@ |
||
17 | 17 | class EE_CPT_Where_Conditions extends EE_CPT_Minimum_Where_Conditions{ |
18 | 18 | /** |
19 | 19 | * Gets the where default where conditions for a custom post type model |
20 | - * @param string $model_relation_path. Eg, from Event to Payment, this should be "Registration.Transaction.Payment" |
|
21 | 20 | * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions) |
22 | 21 | */ |
23 | 22 | protected function _get_default_where_conditions() { |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * * @since 4.6.0 |
15 | 15 | * |
16 | 16 | */ |
17 | -class EE_CPT_Where_Conditions extends EE_CPT_Minimum_Where_Conditions{ |
|
17 | +class EE_CPT_Where_Conditions extends EE_CPT_Minimum_Where_Conditions { |
|
18 | 18 | /** |
19 | 19 | * Gets the where default where conditions for a custom post type model |
20 | 20 | * @param string $model_relation_path. Eg, from Event to Payment, this should be "Registration.Transaction.Payment" |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | return array_merge( |
26 | 26 | parent::_get_default_where_conditions(), |
27 | 27 | array( |
28 | - $status_field->get_name() => array('NOT IN',array('auto-draft','trash') ) |
|
28 | + $status_field->get_name() => array('NOT IN', array('auto-draft', 'trash')) |
|
29 | 29 | ) |
30 | 30 | ); |
31 | 31 | } |
@@ -5,7 +5,7 @@ |
||
5 | 5 | /** |
6 | 6 | * |
7 | 7 | * Class EE_CPT_Minimum_Where_Conditions |
8 | - * |
|
8 | + * |
|
9 | 9 | * Strategy specifically for adding where conditions specific to CPT models. |
10 | 10 | * But only sets the minimum, so any row of the right type will get used |
11 | 11 | * |
@@ -32,11 +32,11 @@ |
||
32 | 32 | interface RequestMethod |
33 | 33 | { |
34 | 34 | |
35 | - /** |
|
36 | - * Submit the request with the specified parameters. |
|
37 | - * |
|
38 | - * @param RequestParameters $params Request parameters |
|
39 | - * @return string Body of the reCAPTCHA response |
|
40 | - */ |
|
41 | - public function submit(RequestParameters $params); |
|
35 | + /** |
|
36 | + * Submit the request with the specified parameters. |
|
37 | + * |
|
38 | + * @param RequestParameters $params Request parameters |
|
39 | + * @return string Body of the reCAPTCHA response |
|
40 | + */ |
|
41 | + public function submit(RequestParameters $params); |
|
42 | 42 | } |
@@ -534,7 +534,7 @@ |
||
534 | 534 | *@param EE_Message $message |
535 | 535 | * @param EE_Messenger $messenger |
536 | 536 | * @param EE_message_type $message_type |
537 | - * @param $test_send |
|
537 | + * @param boolean $test_send |
|
538 | 538 | * @return bool true means all went well, false means, not so much. |
539 | 539 | */ |
540 | 540 | protected function _do_preview( EE_Message $message, EE_Messenger $messenger, EE_message_type $message_type, $test_send ) { |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @param \EE_Message_Repository $message_repository |
73 | 73 | */ |
74 | - public function __construct( EE_Message_Repository $message_repository ) { |
|
75 | - $this->_batch_count = apply_filters( 'FHEE__EE_Messages_Queue___batch_count', 50 ); |
|
74 | + public function __construct(EE_Message_Repository $message_repository) { |
|
75 | + $this->_batch_count = apply_filters('FHEE__EE_Messages_Queue___batch_count', 50); |
|
76 | 76 | $this->_rate_limit = $this->get_rate_limit(); |
77 | 77 | $this->_queue = $message_repository; |
78 | 78 | } |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | * use the messenger send method but typically is based on preview data. |
92 | 92 | * @return bool Whether the message was successfully added to the repository or not. |
93 | 93 | */ |
94 | - public function add( EE_Message $message, $data = array(), $preview = false, $test_send = false ) { |
|
94 | + public function add(EE_Message $message, $data = array(), $preview = false, $test_send = false) { |
|
95 | 95 | $data['preview'] = $preview; |
96 | 96 | $data['test_send'] = $test_send; |
97 | - return $this->_queue->add( $message, $data ); |
|
97 | + return $this->_queue->add($message, $data); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -106,13 +106,13 @@ discard block |
||
106 | 106 | * @param bool $persist This flag indicates whether to attempt to delete the object from the db as well. |
107 | 107 | * @return bool |
108 | 108 | */ |
109 | - public function remove( EE_Message $message, $persist = false ) { |
|
110 | - if ( $persist && $this->_queue->current() !== $message ) { |
|
109 | + public function remove(EE_Message $message, $persist = false) { |
|
110 | + if ($persist && $this->_queue->current() !== $message) { |
|
111 | 111 | //get pointer on right message |
112 | - if ( $this->_queue->has( $message ) ) { |
|
112 | + if ($this->_queue->has($message)) { |
|
113 | 113 | $this->_queue->rewind(); |
114 | - while( $this->_queue->valid() ) { |
|
115 | - if ( $this->_queue->current() === $message ) { |
|
114 | + while ($this->_queue->valid()) { |
|
115 | + if ($this->_queue->current() === $message) { |
|
116 | 116 | break; |
117 | 117 | } |
118 | 118 | $this->_queue->next(); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | return false; |
122 | 122 | } |
123 | 123 | } |
124 | - return $persist ? $this->_queue->delete() : $this->_queue->remove( $message ); |
|
124 | + return $persist ? $this->_queue->delete() : $this->_queue->remove($message); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | |
@@ -161,29 +161,29 @@ discard block |
||
161 | 161 | * @return bool true if successfully retrieved batch, false no batch ready. |
162 | 162 | */ |
163 | 163 | public function get_batch_to_generate() { |
164 | - if ( $this->is_locked( EE_Messages_Queue::action_generating ) ) { |
|
164 | + if ($this->is_locked(EE_Messages_Queue::action_generating)) { |
|
165 | 165 | return false; |
166 | 166 | } |
167 | 167 | |
168 | 168 | //lock batch generation to prevent race conditions. |
169 | - $this->lock_queue( EE_Messages_Queue::action_generating ); |
|
169 | + $this->lock_queue(EE_Messages_Queue::action_generating); |
|
170 | 170 | |
171 | 171 | $query_args = array( |
172 | 172 | // key 0 = where conditions |
173 | - 0 => array( 'STS_ID' => EEM_Message::status_incomplete ), |
|
173 | + 0 => array('STS_ID' => EEM_Message::status_incomplete), |
|
174 | 174 | 'order_by' => $this->_get_priority_orderby(), |
175 | 175 | 'limit' => $this->_batch_count |
176 | 176 | ); |
177 | - $messages = EEM_Message::instance()->get_all( $query_args ); |
|
177 | + $messages = EEM_Message::instance()->get_all($query_args); |
|
178 | 178 | |
179 | - if ( ! $messages ) { |
|
179 | + if ( ! $messages) { |
|
180 | 180 | return false; //nothing to generate |
181 | 181 | } |
182 | 182 | |
183 | - foreach ( $messages as $message ) { |
|
184 | - if ( $message instanceof EE_Message ) { |
|
183 | + foreach ($messages as $message) { |
|
184 | + if ($message instanceof EE_Message) { |
|
185 | 185 | $data = $message->all_extra_meta_array(); |
186 | - $this->add( $message, $data ); |
|
186 | + $this->add($message, $data); |
|
187 | 187 | } |
188 | 188 | } |
189 | 189 | return true; |
@@ -206,34 +206,34 @@ discard block |
||
206 | 206 | * to assist with notifying user. |
207 | 207 | */ |
208 | 208 | public function get_to_send_batch_and_send() { |
209 | - if ( $this->is_locked( EE_Messages_Queue::action_sending ) || $this->_rate_limit < 1 ) { |
|
209 | + if ($this->is_locked(EE_Messages_Queue::action_sending) || $this->_rate_limit < 1) { |
|
210 | 210 | return false; |
211 | 211 | } |
212 | 212 | |
213 | - $this->lock_queue( EE_Messages_Queue::action_sending ); |
|
213 | + $this->lock_queue(EE_Messages_Queue::action_sending); |
|
214 | 214 | |
215 | 215 | $batch = $this->_batch_count < $this->_rate_limit ? $this->_batch_count : $this->_rate_limit; |
216 | 216 | |
217 | 217 | $query_args = array( |
218 | 218 | // key 0 = where conditions |
219 | - 0 => array( 'STS_ID' => array( 'IN', EEM_Message::instance()->stati_indicating_to_send() ) ), |
|
219 | + 0 => array('STS_ID' => array('IN', EEM_Message::instance()->stati_indicating_to_send())), |
|
220 | 220 | 'order_by' => $this->_get_priority_orderby(), |
221 | 221 | 'limit' => $batch |
222 | 222 | ); |
223 | 223 | |
224 | - $messages_to_send = EEM_Message::instance()->get_all( $query_args ); |
|
224 | + $messages_to_send = EEM_Message::instance()->get_all($query_args); |
|
225 | 225 | |
226 | 226 | |
227 | 227 | //any to send? |
228 | - if ( ! $messages_to_send ) { |
|
229 | - $this->unlock_queue( EE_Messages_Queue::action_sending ); |
|
228 | + if ( ! $messages_to_send) { |
|
229 | + $this->unlock_queue(EE_Messages_Queue::action_sending); |
|
230 | 230 | return false; |
231 | 231 | } |
232 | 232 | |
233 | 233 | //add to queue. |
234 | - foreach ( $messages_to_send as $message ) { |
|
235 | - if ( $message instanceof EE_Message ) { |
|
236 | - $this->add( $message ); |
|
234 | + foreach ($messages_to_send as $message) { |
|
235 | + if ($message instanceof EE_Message) { |
|
236 | + $this->add($message); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $this->execute(); |
242 | 242 | |
243 | 243 | //release lock |
244 | - $this->unlock_queue( EE_Messages_Queue::action_sending ); |
|
244 | + $this->unlock_queue(EE_Messages_Queue::action_sending); |
|
245 | 245 | return true; |
246 | 246 | } |
247 | 247 | |
@@ -253,8 +253,8 @@ discard block |
||
253 | 253 | * |
254 | 254 | * @param string $type The type of queue being locked. |
255 | 255 | */ |
256 | - public function lock_queue( $type = EE_Messages_Queue::action_generating ) { |
|
257 | - set_transient( $this->_get_lock_key( $type ), 1, $this->_get_lock_expiry( $type ) ); |
|
256 | + public function lock_queue($type = EE_Messages_Queue::action_generating) { |
|
257 | + set_transient($this->_get_lock_key($type), 1, $this->_get_lock_expiry($type)); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @param string $type The type of queue being unlocked. |
267 | 267 | */ |
268 | - public function unlock_queue( $type = EE_Messages_Queue::action_generating ) { |
|
269 | - delete_transient( $this->_get_lock_key( $type ) ); |
|
268 | + public function unlock_queue($type = EE_Messages_Queue::action_generating) { |
|
269 | + delete_transient($this->_get_lock_key($type)); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | * @param string $type The type of lock. |
278 | 278 | * @return string |
279 | 279 | */ |
280 | - protected function _get_lock_key( $type = EE_Messages_Queue::action_generating ) { |
|
281 | - return '_ee_lock_' . $type; |
|
280 | + protected function _get_lock_key($type = EE_Messages_Queue::action_generating) { |
|
281 | + return '_ee_lock_'.$type; |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | |
@@ -289,8 +289,8 @@ discard block |
||
289 | 289 | * @param string $type The type of lock |
290 | 290 | * @return int time to expiry in seconds. |
291 | 291 | */ |
292 | - protected function _get_lock_expiry( $type = EE_Messages_Queue::action_generating ) { |
|
293 | - return (int) apply_filters( 'FHEE__EE_Messages_Queue__lock_expiry', HOUR_IN_SECONDS, $type ); |
|
292 | + protected function _get_lock_expiry($type = EE_Messages_Queue::action_generating) { |
|
293 | + return (int) apply_filters('FHEE__EE_Messages_Queue__lock_expiry', HOUR_IN_SECONDS, $type); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | * @return int |
309 | 309 | */ |
310 | 310 | protected function _get_rate_limit_expiry() { |
311 | - return (int) apply_filters( 'FHEE__EE_Messages_Queue__rate_limit_expiry', HOUR_IN_SECONDS ); |
|
311 | + return (int) apply_filters('FHEE__EE_Messages_Queue__rate_limit_expiry', HOUR_IN_SECONDS); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | * @return int |
320 | 320 | */ |
321 | 321 | protected function _default_rate_limit() { |
322 | - return (int) apply_filters( 'FHEE__EE_Messages_Queue___rate_limit', 200 ); |
|
322 | + return (int) apply_filters('FHEE__EE_Messages_Queue___rate_limit', 200); |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
@@ -345,8 +345,8 @@ discard block |
||
345 | 345 | * @param string $type The type of lock being checked for. |
346 | 346 | * @return bool |
347 | 347 | */ |
348 | - public function is_locked( $type = EE_Messages_Queue::action_generating ) { |
|
349 | - return (bool) get_transient( $this->_get_lock_key( $type ) ); |
|
348 | + public function is_locked($type = EE_Messages_Queue::action_generating) { |
|
349 | + return (bool) get_transient($this->_get_lock_key($type)); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | |
@@ -361,9 +361,9 @@ discard block |
||
361 | 361 | * @return int |
362 | 362 | */ |
363 | 363 | public function get_rate_limit() { |
364 | - if ( ! $rate_limit = get_transient( $this->_get_rate_limit_key() ) ) { |
|
364 | + if ( ! $rate_limit = get_transient($this->_get_rate_limit_key())) { |
|
365 | 365 | $rate_limit = $this->_default_rate_limit(); |
366 | - set_transient( $this->_get_rate_limit_key(), $rate_limit, $this->_get_rate_limit_key() ); |
|
366 | + set_transient($this->_get_rate_limit_key(), $rate_limit, $this->_get_rate_limit_key()); |
|
367 | 367 | } |
368 | 368 | return $rate_limit; |
369 | 369 | } |
@@ -375,12 +375,12 @@ discard block |
||
375 | 375 | * This updates existing rate limit with the new limit which is the old minus the batch. |
376 | 376 | * @param int $batch_completed This sets the new rate limit based on the given batch that was completed. |
377 | 377 | */ |
378 | - public function set_rate_limit( $batch_completed ) { |
|
378 | + public function set_rate_limit($batch_completed) { |
|
379 | 379 | //first get the most up to date rate limit (in case its expired and reset) |
380 | 380 | $rate_limit = $this->get_rate_limit(); |
381 | 381 | $new_limit = $rate_limit - $batch_completed; |
382 | 382 | //updating the transient option directly to avoid resetting the expiry. |
383 | - update_option( '_transient_' . $this->_get_rate_limit_key(), $new_limit ); |
|
383 | + update_option('_transient_'.$this->_get_rate_limit_key(), $new_limit); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | * @param string $task This indicates what type of request is going to be initiated. |
394 | 394 | * @param int $priority This indicates the priority that triggers initiating the request. |
395 | 395 | */ |
396 | - public function initiate_request_by_priority( $task = 'generate', $priority = EEM_Message::priority_high ) { |
|
396 | + public function initiate_request_by_priority($task = 'generate', $priority = EEM_Message::priority_high) { |
|
397 | 397 | //determine what status is matched with the priority as part of the trigger conditions. |
398 | 398 | $status = $task == 'generate' |
399 | 399 | ? EEM_Message::status_incomplete |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | // always make sure we save because either this will get executed immediately on a separate request |
402 | 402 | // or remains in the queue for the regularly scheduled queue batch. |
403 | 403 | $this->save(); |
404 | - if ( $this->_queue->count_by_priority_and_status( $priority, $status ) ) { |
|
405 | - EE_Messages_Scheduler::initiate_scheduled_non_blocking_request( $task ); |
|
404 | + if ($this->_queue->count_by_priority_and_status($priority, $status)) { |
|
405 | + EE_Messages_Scheduler::initiate_scheduled_non_blocking_request($task); |
|
406 | 406 | } |
407 | 407 | } |
408 | 408 | |
@@ -427,50 +427,50 @@ discard block |
||
427 | 427 | * Also, if the messenger is an request type messenger (or a preview), |
428 | 428 | * its entirely possible that the messenger will exit before |
429 | 429 | */ |
430 | - public function execute( $save = true, $sending_messenger = null, $by_priority = false ) { |
|
430 | + public function execute($save = true, $sending_messenger = null, $by_priority = false) { |
|
431 | 431 | $messages_sent = 0; |
432 | 432 | $this->_did_hook = array(); |
433 | 433 | $this->_queue->rewind(); |
434 | - while ( $this->_queue->valid() ) { |
|
434 | + while ($this->_queue->valid()) { |
|
435 | 435 | $error_messages = array(); |
436 | 436 | /** @type EE_Message $message */ |
437 | 437 | $message = $this->_queue->current(); |
438 | 438 | //if the message in the queue has a sent status, then skip |
439 | - if ( in_array( $message->STS_ID(), EEM_Message::instance()->stati_indicating_sent() ) ) { |
|
439 | + if (in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_sent())) { |
|
440 | 440 | continue; |
441 | 441 | } |
442 | 442 | //if $by_priority is set and does not match then continue; |
443 | - if ( $by_priority && $by_priority != $message->priority() ) { |
|
443 | + if ($by_priority && $by_priority != $message->priority()) { |
|
444 | 444 | continue; |
445 | 445 | } |
446 | 446 | //error checking |
447 | - if ( ! $message->valid_messenger() ) { |
|
447 | + if ( ! $message->valid_messenger()) { |
|
448 | 448 | $error_messages[] = sprintf( |
449 | - __( 'The %s messenger is not active at time of sending.', 'event_espresso' ), |
|
449 | + __('The %s messenger is not active at time of sending.', 'event_espresso'), |
|
450 | 450 | $message->messenger() |
451 | 451 | ); |
452 | 452 | } |
453 | - if ( ! $message->valid_message_type() ) { |
|
453 | + if ( ! $message->valid_message_type()) { |
|
454 | 454 | $error_messages[] = sprintf( |
455 | - __( 'The %s message type is not active at the time of sending.', 'event_espresso' ), |
|
455 | + __('The %s message type is not active at the time of sending.', 'event_espresso'), |
|
456 | 456 | $message->message_type() |
457 | 457 | ); |
458 | 458 | } |
459 | 459 | // if there was supposed to be a sending messenger for this message, but it was invalid/inactive, |
460 | 460 | // then it will instead be an EE_Error object, so let's check for that |
461 | - if ( $sending_messenger instanceof EE_Error ) { |
|
461 | + if ($sending_messenger instanceof EE_Error) { |
|
462 | 462 | $error_messages[] = $sending_messenger->getMessage(); |
463 | 463 | } |
464 | 464 | // if there are no errors, then let's process the message |
465 | - if ( empty( $error_messages ) && $this->_process_message( $message, $sending_messenger ) ) { |
|
465 | + if (empty($error_messages) && $this->_process_message($message, $sending_messenger)) { |
|
466 | 466 | $messages_sent++; |
467 | 467 | } |
468 | - $this->_set_error_message( $message, $error_messages ); |
|
468 | + $this->_set_error_message($message, $error_messages); |
|
469 | 469 | //add modified time |
470 | - $message->set_modified( time() ); |
|
470 | + $message->set_modified(time()); |
|
471 | 471 | $this->_queue->next(); |
472 | 472 | } |
473 | - if ( $save ) { |
|
473 | + if ($save) { |
|
474 | 474 | $this->save(); |
475 | 475 | } |
476 | 476 | return $messages_sent; |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | * @param mixed $sending_messenger (optional) |
486 | 486 | * @return bool |
487 | 487 | */ |
488 | - protected function _process_message( EE_Message $message, $sending_messenger = null ) { |
|
488 | + protected function _process_message(EE_Message $message, $sending_messenger = null) { |
|
489 | 489 | // these *should* have been validated in the execute() method above |
490 | 490 | $messenger = $message->messenger_object(); |
491 | 491 | $message_type = $message->message_type_object(); |
@@ -495,20 +495,20 @@ discard block |
||
495 | 495 | && $messenger instanceof EE_messenger |
496 | 496 | && $sending_messenger->name != $messenger->name |
497 | 497 | ) { |
498 | - $messenger->do_secondary_messenger_hooks( $sending_messenger->name ); |
|
498 | + $messenger->do_secondary_messenger_hooks($sending_messenger->name); |
|
499 | 499 | $messenger = $sending_messenger; |
500 | 500 | } |
501 | 501 | // send using messenger, but double check objects |
502 | - if ( $messenger instanceof EE_messenger && $message_type instanceof EE_message_type ) { |
|
502 | + if ($messenger instanceof EE_messenger && $message_type instanceof EE_message_type) { |
|
503 | 503 | //set hook for message type (but only if not using another messenger to send). |
504 | - if ( ! isset( $this->_did_hook[ $message_type->name ] ) ) { |
|
505 | - $message_type->do_messenger_hooks( $messenger ); |
|
506 | - $this->_did_hook[ $message_type->name ] = 1; |
|
504 | + if ( ! isset($this->_did_hook[$message_type->name])) { |
|
505 | + $message_type->do_messenger_hooks($messenger); |
|
506 | + $this->_did_hook[$message_type->name] = 1; |
|
507 | 507 | } |
508 | 508 | //if preview then use preview method |
509 | 509 | return $this->_queue->is_preview() |
510 | - ? $this->_do_preview( $message, $messenger, $message_type, $this->_queue->is_test_send() ) |
|
511 | - : $this->_do_send( $message, $messenger, $message_type ); |
|
510 | + ? $this->_do_preview($message, $messenger, $message_type, $this->_queue->is_test_send()) |
|
511 | + : $this->_do_send($message, $messenger, $message_type); |
|
512 | 512 | } |
513 | 513 | return false; |
514 | 514 | } |
@@ -526,12 +526,12 @@ discard block |
||
526 | 526 | * @param array $status Stati to check for in queue |
527 | 527 | * @return int Count of EE_Message's matching the given status. |
528 | 528 | */ |
529 | - public function count_STS_in_queue( $status ) { |
|
529 | + public function count_STS_in_queue($status) { |
|
530 | 530 | $count = 0; |
531 | - $status = is_array( $status ) ? $status : array( $status ); |
|
531 | + $status = is_array($status) ? $status : array($status); |
|
532 | 532 | $this->_queue->rewind(); |
533 | - foreach( $this->_queue as $message ) { |
|
534 | - if ( in_array( $message->STS_ID(), $status ) ) { |
|
533 | + foreach ($this->_queue as $message) { |
|
534 | + if (in_array($message->STS_ID(), $status)) { |
|
535 | 535 | $count++; |
536 | 536 | } |
537 | 537 | } |
@@ -548,15 +548,15 @@ discard block |
||
548 | 548 | * @param $test_send |
549 | 549 | * @return bool true means all went well, false means, not so much. |
550 | 550 | */ |
551 | - protected function _do_preview( EE_Message $message, EE_messenger $messenger, EE_message_type $message_type, $test_send ) { |
|
552 | - if ( $preview = $messenger->get_preview( $message, $message_type, $test_send ) ) { |
|
553 | - if ( ! $test_send ) { |
|
554 | - $message->set_content( $preview ); |
|
551 | + protected function _do_preview(EE_Message $message, EE_messenger $messenger, EE_message_type $message_type, $test_send) { |
|
552 | + if ($preview = $messenger->get_preview($message, $message_type, $test_send)) { |
|
553 | + if ( ! $test_send) { |
|
554 | + $message->set_content($preview); |
|
555 | 555 | } |
556 | - $message->set_STS_ID( EEM_Message::status_sent ); |
|
556 | + $message->set_STS_ID(EEM_Message::status_sent); |
|
557 | 557 | return true; |
558 | 558 | } else { |
559 | - $message->set_STS_ID( EEM_Message::status_failed ); |
|
559 | + $message->set_STS_ID(EEM_Message::status_failed); |
|
560 | 560 | return false; |
561 | 561 | } |
562 | 562 | } |
@@ -572,12 +572,12 @@ discard block |
||
572 | 572 | * @param EE_message_type $message_type |
573 | 573 | * @return bool true means all went well, false means, not so much. |
574 | 574 | */ |
575 | - protected function _do_send( EE_Message $message, EE_messenger $messenger, EE_message_type $message_type ) { |
|
576 | - if ( $messenger->send_message( $message, $message_type ) ) { |
|
577 | - $message->set_STS_ID( EEM_Message::status_sent ); |
|
575 | + protected function _do_send(EE_Message $message, EE_messenger $messenger, EE_message_type $message_type) { |
|
576 | + if ($messenger->send_message($message, $message_type)) { |
|
577 | + $message->set_STS_ID(EEM_Message::status_sent); |
|
578 | 578 | return true; |
579 | 579 | } else { |
580 | - $message->set_STS_ID( EEM_Message::status_retry ); |
|
580 | + $message->set_STS_ID(EEM_Message::status_retry); |
|
581 | 581 | return false; |
582 | 582 | } |
583 | 583 | } |
@@ -591,21 +591,21 @@ discard block |
||
591 | 591 | * @param EE_Message $message |
592 | 592 | * @param array $error_messages the response from the messenger. |
593 | 593 | */ |
594 | - protected function _set_error_message( EE_Message $message, $error_messages ) { |
|
594 | + protected function _set_error_message(EE_Message $message, $error_messages) { |
|
595 | 595 | $error_messages = (array) $error_messages; |
596 | - if ( in_array( $message->STS_ID(), EEM_Message::instance()->stati_indicating_failed_sending() ) ) { |
|
596 | + if (in_array($message->STS_ID(), EEM_Message::instance()->stati_indicating_failed_sending())) { |
|
597 | 597 | $notices = EE_Error::has_notices(); |
598 | - $error_messages[] = __( 'Messenger and Message Type were valid and active, but the messenger send method failed.', 'event_espresso' ); |
|
599 | - if ( $notices === 1 ) { |
|
598 | + $error_messages[] = __('Messenger and Message Type were valid and active, but the messenger send method failed.', 'event_espresso'); |
|
599 | + if ($notices === 1) { |
|
600 | 600 | $notices = EE_Error::get_vanilla_notices(); |
601 | - $notices['errors'] = isset( $notices['errors'] ) ? $notices['errors'] : array(); |
|
602 | - $error_messages[] = implode( "\n", $notices['errors'] ); |
|
601 | + $notices['errors'] = isset($notices['errors']) ? $notices['errors'] : array(); |
|
602 | + $error_messages[] = implode("\n", $notices['errors']); |
|
603 | 603 | } |
604 | 604 | } |
605 | - if ( count( $error_messages ) > 0 ) { |
|
606 | - $msg = __( 'Message was not executed successfully.', 'event_espresso' ); |
|
607 | - $msg = $msg . "\n" . implode( "\n", $error_messages ); |
|
608 | - $message->set_error_message( $msg ); |
|
605 | + if (count($error_messages) > 0) { |
|
606 | + $msg = __('Message was not executed successfully.', 'event_espresso'); |
|
607 | + $msg = $msg."\n".implode("\n", $error_messages); |
|
608 | + $message->set_error_message($msg); |
|
609 | 609 | } |
610 | 610 | } |
611 | 611 |