@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * @param array $props_n_values |
31 | 31 | * @return EE_Post_Meta|mixed |
32 | 32 | */ |
33 | - public static function new_instance( $props_n_values = array() ) { |
|
34 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
35 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
33 | + public static function new_instance($props_n_values = array()) { |
|
34 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
35 | + return $has_object ? $has_object : new self($props_n_values); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * @param array $props_n_values |
42 | 42 | * @return EE_Post_Meta |
43 | 43 | */ |
44 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
45 | - return new self( $props_n_values, TRUE ); |
|
44 | + public static function new_instance_from_db($props_n_values = array()) { |
|
45 | + return new self($props_n_values, TRUE); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @return int |
53 | 53 | */ |
54 | 54 | function meta_id() { |
55 | - return $this->get( 'meta_id' ); |
|
55 | + return $this->get('meta_id'); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | * @param int $meta_id |
63 | 63 | * @return boolean |
64 | 64 | */ |
65 | - function set_meta_id( $meta_id) { |
|
66 | - return $this->set( 'meta_id', $meta_id); |
|
65 | + function set_meta_id($meta_id) { |
|
66 | + return $this->set('meta_id', $meta_id); |
|
67 | 67 | } |
68 | 68 | /** |
69 | 69 | * Gets post_id |
70 | 70 | * @return int |
71 | 71 | */ |
72 | 72 | function post_id() { |
73 | - return $this->get( 'post_id' ); |
|
73 | + return $this->get('post_id'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | * @param int $post_id |
81 | 81 | * @return boolean |
82 | 82 | */ |
83 | - function set_post_id( $post_id) { |
|
84 | - return $this->set( 'post_id', $post_id); |
|
83 | + function set_post_id($post_id) { |
|
84 | + return $this->set('post_id', $post_id); |
|
85 | 85 | } |
86 | 86 | /** |
87 | 87 | * Gets meta_key |
88 | 88 | * @return string |
89 | 89 | */ |
90 | 90 | function meta_key() { |
91 | - return $this->get( 'meta_key' ); |
|
91 | + return $this->get('meta_key'); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | |
@@ -98,15 +98,15 @@ discard block |
||
98 | 98 | * @param string $meta_key |
99 | 99 | * @return boolean |
100 | 100 | */ |
101 | - function set_meta_key( $meta_key) { |
|
102 | - return $this->set( 'meta_key', $meta_key); |
|
101 | + function set_meta_key($meta_key) { |
|
102 | + return $this->set('meta_key', $meta_key); |
|
103 | 103 | } |
104 | 104 | /** |
105 | 105 | * Gets meta_value |
106 | 106 | * @return mixed |
107 | 107 | */ |
108 | 108 | function meta_value() { |
109 | - return $this->get( 'meta_value' ); |
|
109 | + return $this->get('meta_value'); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | |
@@ -116,8 +116,8 @@ discard block |
||
116 | 116 | * @param mixed $meta_value |
117 | 117 | * @return boolean |
118 | 118 | */ |
119 | - function set_meta_value( $meta_value) { |
|
120 | - return $this->set( 'meta_value', $meta_value); |
|
119 | + function set_meta_value($meta_value) { |
|
120 | + return $this->set('meta_value', $meta_value); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * Sets meta_id |
62 | 62 | * @param int $meta_id |
63 | - * @return boolean |
|
63 | + * @return boolean|null |
|
64 | 64 | */ |
65 | 65 | function set_meta_id( $meta_id) { |
66 | 66 | return $this->set( 'meta_id', $meta_id); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | /** |
79 | 79 | * Sets post_id |
80 | 80 | * @param int $post_id |
81 | - * @return boolean |
|
81 | + * @return boolean|null |
|
82 | 82 | */ |
83 | 83 | function set_post_id( $post_id) { |
84 | 84 | return $this->set( 'post_id', $post_id); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | /** |
97 | 97 | * Sets meta_key |
98 | 98 | * @param string $meta_key |
99 | - * @return boolean |
|
99 | + * @return boolean|null |
|
100 | 100 | */ |
101 | 101 | function set_meta_key( $meta_key) { |
102 | 102 | return $this->set( 'meta_key', $meta_key); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * Sets meta_value |
116 | 116 | * @param mixed $meta_value |
117 | - * @return boolean |
|
117 | + * @return boolean|null |
|
118 | 118 | */ |
119 | 119 | function set_meta_value( $meta_value) { |
120 | 120 | return $this->set( 'meta_value', $meta_value); |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -90,7 +92,7 @@ discard block |
||
90 | 92 | if( $answer_obj instanceof EE_Answer ){ |
91 | 93 | if($pretty_answer){ |
92 | 94 | $value = $answer_obj->pretty_value(); |
93 | - }else{ |
|
95 | + } else{ |
|
94 | 96 | $value = $answer_obj->value(); |
95 | 97 | } |
96 | 98 | } |
@@ -148,7 +150,7 @@ discard block |
||
148 | 150 | $value = $registration->attendee()->get_pretty( $field_name ); |
149 | 151 | } |
150 | 152 | //if field name is blank, leave the value as null too |
151 | - }else{ |
|
153 | + } else{ |
|
152 | 154 | $value = $registration->attendee()->get( $field_name ); |
153 | 155 | } |
154 | 156 | } |
@@ -125,14 +125,14 @@ |
||
125 | 125 | public function get_attendee_property_answer_value( EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE ){ |
126 | 126 | $field_name = NULL; |
127 | 127 | $value = NULL; |
128 | - //backward compat: we still want to find the question's ID |
|
129 | - if( is_numeric( $question_system_id ) ) { |
|
130 | - //find this question's QST_system value |
|
131 | - $question_id = $question_system_id; |
|
132 | - $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' ); |
|
133 | - } else { |
|
134 | - $question_id = (int) EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ); |
|
135 | - } |
|
128 | + //backward compat: we still want to find the question's ID |
|
129 | + if( is_numeric( $question_system_id ) ) { |
|
130 | + //find this question's QST_system value |
|
131 | + $question_id = $question_system_id; |
|
132 | + $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' ); |
|
133 | + } else { |
|
134 | + $question_id = (int) EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ); |
|
135 | + } |
|
136 | 136 | //only bother checking if the registration has an attendee |
137 | 137 | if( $registration->attendee() instanceof EE_Attendee ) { |
138 | 138 | $field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question( $question_system_id ); |
@@ -51,18 +51,18 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * constructor |
53 | 53 | */ |
54 | - protected function __construct( $timezone = NULL ){ |
|
55 | - $this->singular_item = __('Answer','event_espresso'); |
|
56 | - $this->plural_item = __('Answers','event_espresso'); |
|
54 | + protected function __construct($timezone = NULL) { |
|
55 | + $this->singular_item = __('Answer', 'event_espresso'); |
|
56 | + $this->plural_item = __('Answers', 'event_espresso'); |
|
57 | 57 | $this->_tables = array( |
58 | 58 | 'Answer'=> new EE_Primary_Table('esp_answer', 'ANS_ID') |
59 | 59 | ); |
60 | 60 | $this->_fields = array( |
61 | 61 | 'Answer'=>array( |
62 | - 'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID','event_espresso')), |
|
63 | - 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID','event_espresso'), false, 0, 'Registration'), |
|
64 | - 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'), |
|
65 | - 'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value','event_espresso'), false, '') |
|
62 | + 'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID', 'event_espresso')), |
|
63 | + 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'), |
|
64 | + 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'), |
|
65 | + 'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value', 'event_espresso'), false, '') |
|
66 | 66 | )); |
67 | 67 | $this->_model_relations = array( |
68 | 68 | 'Registration'=>new EE_Belongs_To_Relation(), |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | ); |
71 | 71 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
72 | 72 | $this->_caps_slug = 'registrations'; |
73 | - parent::__construct( $timezone ); |
|
73 | + parent::__construct($timezone); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | |
@@ -83,19 +83,19 @@ discard block |
||
83 | 83 | * @param boolean $pretty_answer whether to call 'pretty_value' or just 'value' |
84 | 84 | * @return string |
85 | 85 | */ |
86 | - public function get_answer_value_to_question( EE_Registration $registration, $question_id = NULL,$pretty_answer = FALSE ){ |
|
87 | - $value = $this->get_attendee_property_answer_value( $registration, $question_id, $pretty_answer ); |
|
88 | - if ( $value === NULL ){ |
|
89 | - $answer_obj = $this->get_registration_question_answer_object( $registration, $question_id); |
|
90 | - if( $answer_obj instanceof EE_Answer ){ |
|
91 | - if($pretty_answer){ |
|
86 | + public function get_answer_value_to_question(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) { |
|
87 | + $value = $this->get_attendee_property_answer_value($registration, $question_id, $pretty_answer); |
|
88 | + if ($value === NULL) { |
|
89 | + $answer_obj = $this->get_registration_question_answer_object($registration, $question_id); |
|
90 | + if ($answer_obj instanceof EE_Answer) { |
|
91 | + if ($pretty_answer) { |
|
92 | 92 | $value = $answer_obj->pretty_value(); |
93 | - }else{ |
|
93 | + } else { |
|
94 | 94 | $value = $answer_obj->value(); |
95 | 95 | } |
96 | 96 | } |
97 | 97 | } |
98 | - return apply_filters( 'FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id ); |
|
98 | + return apply_filters('FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | * @param int $question_id |
107 | 107 | * @return EE_Answer |
108 | 108 | */ |
109 | - public function get_registration_question_answer_object( EE_Registration $registration, $question_id = NULL){ |
|
110 | - $answer_obj = $this->get_one( array( array( 'QST_ID'=>$question_id, 'REG_ID'=>$registration->ID() ))); |
|
111 | - return apply_filters( 'FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id ); |
|
109 | + public function get_registration_question_answer_object(EE_Registration $registration, $question_id = NULL) { |
|
110 | + $answer_obj = $this->get_one(array(array('QST_ID'=>$question_id, 'REG_ID'=>$registration->ID()))); |
|
111 | + return apply_filters('FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id); |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | |
@@ -122,39 +122,39 @@ discard block |
||
122 | 122 | * @return string|null (if the registration has no attendee, or the question_system_id is not a QST_ID or QST_system for |
123 | 123 | * a question corresponding to an attendee field, returns null) |
124 | 124 | */ |
125 | - public function get_attendee_property_answer_value( EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE ){ |
|
125 | + public function get_attendee_property_answer_value(EE_Registration $registration, $question_system_id = NULL, $pretty_answer = FALSE) { |
|
126 | 126 | $field_name = NULL; |
127 | 127 | $value = NULL; |
128 | 128 | //backward compat: we still want to find the question's ID |
129 | - if( is_numeric( $question_system_id ) ) { |
|
129 | + if (is_numeric($question_system_id)) { |
|
130 | 130 | //find this question's QST_system value |
131 | 131 | $question_id = $question_system_id; |
132 | - $question_system_id = EEM_Question::instance()->get_var( array( array( 'QST_ID' => $question_system_id ) ), 'QST_system' ); |
|
132 | + $question_system_id = EEM_Question::instance()->get_var(array(array('QST_ID' => $question_system_id)), 'QST_system'); |
|
133 | 133 | } else { |
134 | - $question_id = (int) EEM_Question::instance()->get_var( array( array( 'QST_system' => $question_system_id ) ), 'QST_ID' ); |
|
134 | + $question_id = (int) EEM_Question::instance()->get_var(array(array('QST_system' => $question_system_id)), 'QST_ID'); |
|
135 | 135 | } |
136 | 136 | //only bother checking if the registration has an attendee |
137 | - if( $registration->attendee() instanceof EE_Attendee ) { |
|
138 | - $field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question( $question_system_id ); |
|
139 | - if( $field_name ) { |
|
140 | - if( $pretty_answer ) { |
|
141 | - if( $field_name === 'STA_ID' ) { |
|
137 | + if ($registration->attendee() instanceof EE_Attendee) { |
|
138 | + $field_name = EEM_Attendee::instance()->get_attendee_field_for_system_question($question_system_id); |
|
139 | + if ($field_name) { |
|
140 | + if ($pretty_answer) { |
|
141 | + if ($field_name === 'STA_ID') { |
|
142 | 142 | $state = $registration->attendee()->state_obj(); |
143 | - $value = $state instanceof EE_State ? $state->name() : sprintf( __('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID() ); |
|
144 | - } else if($field_name === 'CNT_ISO') { |
|
143 | + $value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID()); |
|
144 | + } else if ($field_name === 'CNT_ISO') { |
|
145 | 145 | $country = $registration->attendee()->country_obj(); |
146 | - $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID()); |
|
146 | + $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"), $registration->attendee()->country_ID()); |
|
147 | 147 | } else { |
148 | - $value = $registration->attendee()->get_pretty( $field_name ); |
|
148 | + $value = $registration->attendee()->get_pretty($field_name); |
|
149 | 149 | } |
150 | 150 | //if field name is blank, leave the value as null too |
151 | - }else{ |
|
152 | - $value = $registration->attendee()->get( $field_name ); |
|
151 | + } else { |
|
152 | + $value = $registration->attendee()->get($field_name); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | //if no field was found, leave value blank |
156 | 156 | } |
157 | - return apply_filters( 'FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id, $question_system_id ); |
|
157 | + return apply_filters('FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id, $question_system_id); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 |
@@ -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 | /** |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * with the exception of a particular attribute |
27 | 27 | * @return object of the same class as what was called on |
28 | 28 | */ |
29 | - public function duplicate( $options = array() ); |
|
29 | + public function duplicate($options = array()); |
|
30 | 30 | |
31 | 31 | |
32 | 32 |
@@ -7,13 +7,13 @@ |
||
7 | 7 | <!-- Facebook sharing information tags --> |
8 | 8 | <meta property="og:title" content="<?php echo $subject; ?>" /> |
9 | 9 | <title><?php echo $subject; ?></title> |
10 | - <?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body ); ?> |
|
10 | + <?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_head', $message_type, $subject, $from, $main_body); ?> |
|
11 | 11 | </head> |
12 | -<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body ); ?> |
|
12 | +<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_header', $message_type, $subject, $from, $main_body); ?> |
|
13 | 13 | <body bgcolor="#FFFFFF" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"> |
14 | -<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body ); ?> |
|
14 | +<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_before_main_body', $message_type, $subject, $from, $main_body); ?> |
|
15 | 15 | <?php echo $main_body; ?> |
16 | -<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body ); ?> |
|
16 | +<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_after_main_body', $message_type, $subject, $from, $main_body); ?> |
|
17 | 17 | </body> |
18 | -<?php do_action( 'AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body ); ?> |
|
18 | +<?php do_action('AHEE__EE_Email_Messenger_main_wrapper_template_footer', $message_type, $subject, $from, $main_body); ?> |
|
19 | 19 | </html> |
20 | 20 | \ No newline at end of file |
@@ -27,21 +27,21 @@ |
||
27 | 27 | <!-- Primary Style Sheet --> |
28 | 28 | <link rel="stylesheet" type="text/css" href="<?php echo $main_css; ?>" /> |
29 | 29 | <!-- Make sure the buttons don't print --> |
30 | - <?php if ( isset( $extra_css )) : ?> |
|
30 | + <?php if (isset($extra_css)) : ?> |
|
31 | 31 | <!-- Additional Style Sheet --> |
32 | 32 | <link rel="stylesheet" type="text/css" href="<?php echo $extra_css; ?>" /> |
33 | 33 | <?php endif; ?> |
34 | 34 | <style type="text/css"> |
35 | 35 | @media print{ .noPrint{ display:none !important;height:0!important; width:0!important; margin:0!important; padding:0!important; }} |
36 | 36 | </style> |
37 | - <?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
37 | + <?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_head', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
38 | 38 | </head> |
39 | - <?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
39 | + <?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_header', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
40 | 40 | <body> |
41 | - <?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
41 | + <?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_before_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
42 | 42 | <?php echo $main_body; ?> |
43 | - <?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
43 | + <?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_after_main_body', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
44 | 44 | </body> |
45 | - <?php do_action( 'AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
45 | + <?php do_action('AHEE__EE_Html_Messenger_main_wrapper_template_footer', $message_type, $page_title, $base_css, $print_css, $main_css, $main_body); ?> |
|
46 | 46 | <?php wp_footer(); ?> |
47 | 47 | </html> |
48 | 48 | \ No newline at end of file |
@@ -123,7 +123,7 @@ |
||
123 | 123 | * @access public |
124 | 124 | * @param EE_Template_Config $CFG |
125 | 125 | * @param array $REQ |
126 | - * @return EE_Events_Archive_Config |
|
126 | + * @return EE_Template_Config |
|
127 | 127 | */ |
128 | 128 | public static function update_template_settings( $CFG, $REQ ) { |
129 | 129 | $config = new EE_Events_Archive_Config(); |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -86,52 +86,52 @@ discard block |
||
86 | 86 | $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object( 'general_settings' ); |
87 | 87 | if ( $gen_set_admin instanceof General_Settings_Admin_Page ) { |
88 | 88 | remove_action( |
89 | - 'AHEE__template_settings__template__before_settings_form', |
|
90 | - array( $gen_set_admin, 'template_settings_caff_features' ), |
|
91 | - 100 |
|
92 | - ); |
|
89 | + 'AHEE__template_settings__template__before_settings_form', |
|
90 | + array( $gen_set_admin, 'template_settings_caff_features' ), |
|
91 | + 100 |
|
92 | + ); |
|
93 | 93 | } |
94 | 94 | // first just grab the template settings |
95 | 95 | $config = EE_Registry::instance()->CFG->template_settings; |
96 | 96 | // then if the Event Archive config is valid, use that, else create a new one |
97 | 97 | $config = isset( $config->EED_Events_Archive ) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config |
98 | - ? $config->EED_Events_Archive |
|
99 | - : new EE_Events_Archive_Config(); |
|
98 | + ? $config->EED_Events_Archive |
|
99 | + : new EE_Events_Archive_Config(); |
|
100 | 100 | $config = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config ); |
101 | 101 | $config->display_status_banner = isset( $config->display_status_banner ) |
102 | - ? $config->display_status_banner |
|
103 | - : 0; |
|
102 | + ? $config->display_status_banner |
|
103 | + : 0; |
|
104 | 104 | $config->display_description = isset( $config->display_description ) |
105 | - ? $config->display_description |
|
106 | - : 1; |
|
105 | + ? $config->display_description |
|
106 | + : 1; |
|
107 | 107 | $config->display_ticket_selector = isset( $config->display_ticket_selector ) |
108 | - ? $config->display_ticket_selector |
|
109 | - : 0; |
|
108 | + ? $config->display_ticket_selector |
|
109 | + : 0; |
|
110 | 110 | $config->display_datetimes = isset( $config->display_datetimes ) |
111 | - ? $config->display_datetimes |
|
112 | - : 1; |
|
111 | + ? $config->display_datetimes |
|
112 | + : 1; |
|
113 | 113 | $config->display_venue = isset( $config->display_venue ) |
114 | - ? $config->display_venue |
|
115 | - : 0; |
|
114 | + ? $config->display_venue |
|
115 | + : 0; |
|
116 | 116 | $config->display_expired_events = isset( $config->display_expired_events ) |
117 | - ? $config->display_expired_events |
|
118 | - : 0; |
|
117 | + ? $config->display_expired_events |
|
118 | + : 0; |
|
119 | 119 | // display order options |
120 | 120 | $config->use_sortable_display_order = isset( $config->use_sortable_display_order ) |
121 | - ? $config->use_sortable_display_order |
|
122 | - : false; |
|
121 | + ? $config->use_sortable_display_order |
|
122 | + : false; |
|
123 | 123 | $config->display_order_tickets = isset( $config->display_order_tickets ) |
124 | - ? $config->display_order_tickets |
|
125 | - : 120; |
|
124 | + ? $config->display_order_tickets |
|
125 | + : 120; |
|
126 | 126 | $config->display_order_datetimes = isset( $config->display_order_datetimes ) |
127 | - ? $config->display_order_datetimes |
|
128 | - : 110; |
|
127 | + ? $config->display_order_datetimes |
|
128 | + : 110; |
|
129 | 129 | $config->display_order_event = isset( $config->display_order_event ) |
130 | - ? $config->display_order_event |
|
131 | - : 100; |
|
130 | + ? $config->display_order_event |
|
131 | + : 100; |
|
132 | 132 | $config->display_order_venue = isset( $config->display_order_venue ) |
133 | - ? $config->display_order_venue |
|
134 | - : 130; |
|
133 | + ? $config->display_order_venue |
|
134 | + : 130; |
|
135 | 135 | // get template parts |
136 | 136 | $template_parts = EED_Events_Archive::instance()->initialize_template_parts( $config ); |
137 | 137 | // convert to array so that we can add more properties |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | $config->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; |
166 | 166 | $config->use_sortable_display_order = isset( $REQ['EED_Events_Archive_use_sortable_display_order'] ) ? absint( $REQ['EED_Events_Archive_use_sortable_display_order'] ) : 0; |
167 | 167 | $config->display_order_event = isset( $CFG->EED_Events_Archive->display_order_event ) && $config->use_sortable_display_order |
168 | - ? $CFG->EED_Events_Archive->display_order_event |
|
169 | - : EED_Events_Archive::EVENT_DETAILS_PRIORITY; |
|
168 | + ? $CFG->EED_Events_Archive->display_order_event |
|
169 | + : EED_Events_Archive::EVENT_DETAILS_PRIORITY; |
|
170 | 170 | $config->display_order_datetimes = isset( $CFG->EED_Events_Archive->display_order_datetimes ) && $config->use_sortable_display_order |
171 | - ? $CFG->EED_Events_Archive->display_order_datetimes |
|
172 | - : EED_Events_Archive::EVENT_DATETIMES_PRIORITY; |
|
171 | + ? $CFG->EED_Events_Archive->display_order_datetimes |
|
172 | + : EED_Events_Archive::EVENT_DATETIMES_PRIORITY; |
|
173 | 173 | $config->display_order_tickets = isset( $CFG->EED_Events_Archive->display_order_tickets ) && $config->use_sortable_display_order |
174 | - ? $CFG->EED_Events_Archive->display_order_tickets |
|
175 | - : EED_Events_Archive::EVENT_TICKETS_PRIORITY; |
|
174 | + ? $CFG->EED_Events_Archive->display_order_tickets |
|
175 | + : EED_Events_Archive::EVENT_TICKETS_PRIORITY; |
|
176 | 176 | $config->display_order_venue = isset( $CFG->EED_Events_Archive->display_order_venue ) && $config->use_sortable_display_order |
177 | - ? $CFG->EED_Events_Archive->display_order_venue |
|
178 | - : EED_Events_Archive::EVENT_VENUES_PRIORITY; |
|
177 | + ? $CFG->EED_Events_Archive->display_order_venue |
|
178 | + : EED_Events_Archive::EVENT_VENUES_PRIORITY; |
|
179 | 179 | } |
180 | 180 | $CFG->EED_Events_Archive = $config; |
181 | 181 | do_action( 'AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ ); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @return EED_Events_Archive_Caff |
29 | 29 | */ |
30 | 30 | public static function instance() { |
31 | - return parent::get_instance( __CLASS__ ); |
|
31 | + return parent::get_instance(__CLASS__); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | |
@@ -49,13 +49,13 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public static function set_hooks_admin() { |
52 | - define( 'EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
53 | - define( 'EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
54 | - add_action( 'AHEE__template_settings__template__before_settings_form', array( 'EED_Events_Archive_Caff', 'template_settings_form' ), 10 ); |
|
55 | - add_filter( 'FHEE__General_Settings_Admin_Page__update_template_settings__data', array( 'EED_Events_Archive_Caff', 'update_template_settings' ), 10, 2 ); |
|
52 | + define('EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
53 | + define('EVENT_ARCHIVE_CAFF_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
54 | + add_action('AHEE__template_settings__template__before_settings_form', array('EED_Events_Archive_Caff', 'template_settings_form'), 10); |
|
55 | + add_filter('FHEE__General_Settings_Admin_Page__update_template_settings__data', array('EED_Events_Archive_Caff', 'update_template_settings'), 10, 2); |
|
56 | 56 | // AJAX |
57 | - add_action( 'wp_ajax_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) ); |
|
58 | - add_action( 'wp_ajax_nopriv_espresso_update_event_archive_order', array( 'EED_Events_Archive_Caff', 'update_event_archive_order' ) ); |
|
57 | + add_action('wp_ajax_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order')); |
|
58 | + add_action('wp_ajax_nopriv_espresso_update_event_archive_order', array('EED_Events_Archive_Caff', 'update_event_archive_order')); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param WP $WP |
69 | 69 | * @return void |
70 | 70 | */ |
71 | - public function run( $WP ) { |
|
71 | + public function run($WP) { |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | |
@@ -83,61 +83,61 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public static function template_settings_form() { |
85 | 85 | // grab general settings admin page and remove the existing hook callback |
86 | - $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object( 'general_settings' ); |
|
87 | - if ( $gen_set_admin instanceof General_Settings_Admin_Page ) { |
|
86 | + $gen_set_admin = EE_Registry::instance()->LIB->EE_Admin_Page_Loader->get_admin_page_object('general_settings'); |
|
87 | + if ($gen_set_admin instanceof General_Settings_Admin_Page) { |
|
88 | 88 | remove_action( |
89 | 89 | 'AHEE__template_settings__template__before_settings_form', |
90 | - array( $gen_set_admin, 'template_settings_caff_features' ), |
|
90 | + array($gen_set_admin, 'template_settings_caff_features'), |
|
91 | 91 | 100 |
92 | 92 | ); |
93 | 93 | } |
94 | 94 | // first just grab the template settings |
95 | 95 | $config = EE_Registry::instance()->CFG->template_settings; |
96 | 96 | // then if the Event Archive config is valid, use that, else create a new one |
97 | - $config = isset( $config->EED_Events_Archive ) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config |
|
97 | + $config = isset($config->EED_Events_Archive) && $config->EED_Events_Archive instanceof EE_Events_Archive_Config |
|
98 | 98 | ? $config->EED_Events_Archive |
99 | 99 | : new EE_Events_Archive_Config(); |
100 | - $config = apply_filters( 'FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config ); |
|
101 | - $config->display_status_banner = isset( $config->display_status_banner ) |
|
100 | + $config = apply_filters('FHEE__EED_Events_Archive__template_settings_form__event_list_config', $config); |
|
101 | + $config->display_status_banner = isset($config->display_status_banner) |
|
102 | 102 | ? $config->display_status_banner |
103 | 103 | : 0; |
104 | - $config->display_description = isset( $config->display_description ) |
|
104 | + $config->display_description = isset($config->display_description) |
|
105 | 105 | ? $config->display_description |
106 | 106 | : 1; |
107 | - $config->display_ticket_selector = isset( $config->display_ticket_selector ) |
|
107 | + $config->display_ticket_selector = isset($config->display_ticket_selector) |
|
108 | 108 | ? $config->display_ticket_selector |
109 | 109 | : 0; |
110 | - $config->display_datetimes = isset( $config->display_datetimes ) |
|
110 | + $config->display_datetimes = isset($config->display_datetimes) |
|
111 | 111 | ? $config->display_datetimes |
112 | 112 | : 1; |
113 | - $config->display_venue = isset( $config->display_venue ) |
|
113 | + $config->display_venue = isset($config->display_venue) |
|
114 | 114 | ? $config->display_venue |
115 | 115 | : 0; |
116 | - $config->display_expired_events = isset( $config->display_expired_events ) |
|
116 | + $config->display_expired_events = isset($config->display_expired_events) |
|
117 | 117 | ? $config->display_expired_events |
118 | 118 | : 0; |
119 | 119 | // display order options |
120 | - $config->use_sortable_display_order = isset( $config->use_sortable_display_order ) |
|
120 | + $config->use_sortable_display_order = isset($config->use_sortable_display_order) |
|
121 | 121 | ? $config->use_sortable_display_order |
122 | 122 | : false; |
123 | - $config->display_order_tickets = isset( $config->display_order_tickets ) |
|
123 | + $config->display_order_tickets = isset($config->display_order_tickets) |
|
124 | 124 | ? $config->display_order_tickets |
125 | 125 | : 120; |
126 | - $config->display_order_datetimes = isset( $config->display_order_datetimes ) |
|
126 | + $config->display_order_datetimes = isset($config->display_order_datetimes) |
|
127 | 127 | ? $config->display_order_datetimes |
128 | 128 | : 110; |
129 | - $config->display_order_event = isset( $config->display_order_event ) |
|
129 | + $config->display_order_event = isset($config->display_order_event) |
|
130 | 130 | ? $config->display_order_event |
131 | 131 | : 100; |
132 | - $config->display_order_venue = isset( $config->display_order_venue ) |
|
132 | + $config->display_order_venue = isset($config->display_order_venue) |
|
133 | 133 | ? $config->display_order_venue |
134 | 134 | : 130; |
135 | 135 | // get template parts |
136 | - $template_parts = EED_Events_Archive::instance()->initialize_template_parts( $config ); |
|
136 | + $template_parts = EED_Events_Archive::instance()->initialize_template_parts($config); |
|
137 | 137 | // convert to array so that we can add more properties |
138 | - $config = get_object_vars( $config ); |
|
139 | - $config[ 'event_archive_display_order' ] = $template_parts->generate_sortable_list_of_template_parts( 'event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js' ); |
|
140 | - EEH_Template::display_template( EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH . 'admin-event-list-settings.template.php', $config ); |
|
138 | + $config = get_object_vars($config); |
|
139 | + $config['event_archive_display_order'] = $template_parts->generate_sortable_list_of_template_parts('event-archive-sortable-js', '', 'archive-sortable-li archive-sortable-js'); |
|
140 | + EEH_Template::display_template(EVENTS_ARCHIVE_CAFF_TEMPLATES_PATH.'admin-event-list-settings.template.php', $config); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | |
@@ -153,32 +153,32 @@ discard block |
||
153 | 153 | * @param array $REQ |
154 | 154 | * @return EE_Events_Archive_Config |
155 | 155 | */ |
156 | - public static function update_template_settings( $CFG, $REQ ) { |
|
156 | + public static function update_template_settings($CFG, $REQ) { |
|
157 | 157 | $config = new EE_Events_Archive_Config(); |
158 | 158 | // unless we are resetting the config... |
159 | - if ( ! isset( $REQ['EED_Events_Archive_reset_event_list_settings'] ) || absint( $REQ['EED_Events_Archive_reset_event_list_settings'] ) !== 1 ) { |
|
160 | - $config->display_status_banner = isset( $REQ['EED_Events_Archive_display_status_banner'] ) ? absint( $REQ['EED_Events_Archive_display_status_banner'] ) : 0; |
|
161 | - $config->display_description = isset( $REQ['EED_Events_Archive_display_description'] ) ? absint( $REQ['EED_Events_Archive_display_description'] ) : 1; |
|
162 | - $config->display_ticket_selector = isset( $REQ['EED_Events_Archive_display_ticket_selector'] ) ? absint( $REQ['EED_Events_Archive_display_ticket_selector'] ) : 0; |
|
163 | - $config->display_datetimes = isset( $REQ['EED_Events_Archive_display_datetimes'] ) ? absint( $REQ['EED_Events_Archive_display_datetimes'] ) : 1; |
|
164 | - $config->display_venue = isset( $REQ['EED_Events_Archive_display_venue'] ) ? absint( $REQ['EED_Events_Archive_display_venue'] ) : 0; |
|
165 | - $config->display_expired_events = isset( $REQ['EED_Events_Archive_display_expired_events'] ) ? absint( $REQ['EED_Events_Archive_display_expired_events'] ) : 0; |
|
166 | - $config->use_sortable_display_order = isset( $REQ['EED_Events_Archive_use_sortable_display_order'] ) ? absint( $REQ['EED_Events_Archive_use_sortable_display_order'] ) : 0; |
|
167 | - $config->display_order_event = isset( $CFG->EED_Events_Archive->display_order_event ) && $config->use_sortable_display_order |
|
159 | + if ( ! isset($REQ['EED_Events_Archive_reset_event_list_settings']) || absint($REQ['EED_Events_Archive_reset_event_list_settings']) !== 1) { |
|
160 | + $config->display_status_banner = isset($REQ['EED_Events_Archive_display_status_banner']) ? absint($REQ['EED_Events_Archive_display_status_banner']) : 0; |
|
161 | + $config->display_description = isset($REQ['EED_Events_Archive_display_description']) ? absint($REQ['EED_Events_Archive_display_description']) : 1; |
|
162 | + $config->display_ticket_selector = isset($REQ['EED_Events_Archive_display_ticket_selector']) ? absint($REQ['EED_Events_Archive_display_ticket_selector']) : 0; |
|
163 | + $config->display_datetimes = isset($REQ['EED_Events_Archive_display_datetimes']) ? absint($REQ['EED_Events_Archive_display_datetimes']) : 1; |
|
164 | + $config->display_venue = isset($REQ['EED_Events_Archive_display_venue']) ? absint($REQ['EED_Events_Archive_display_venue']) : 0; |
|
165 | + $config->display_expired_events = isset($REQ['EED_Events_Archive_display_expired_events']) ? absint($REQ['EED_Events_Archive_display_expired_events']) : 0; |
|
166 | + $config->use_sortable_display_order = isset($REQ['EED_Events_Archive_use_sortable_display_order']) ? absint($REQ['EED_Events_Archive_use_sortable_display_order']) : 0; |
|
167 | + $config->display_order_event = isset($CFG->EED_Events_Archive->display_order_event) && $config->use_sortable_display_order |
|
168 | 168 | ? $CFG->EED_Events_Archive->display_order_event |
169 | 169 | : EED_Events_Archive::EVENT_DETAILS_PRIORITY; |
170 | - $config->display_order_datetimes = isset( $CFG->EED_Events_Archive->display_order_datetimes ) && $config->use_sortable_display_order |
|
170 | + $config->display_order_datetimes = isset($CFG->EED_Events_Archive->display_order_datetimes) && $config->use_sortable_display_order |
|
171 | 171 | ? $CFG->EED_Events_Archive->display_order_datetimes |
172 | 172 | : EED_Events_Archive::EVENT_DATETIMES_PRIORITY; |
173 | - $config->display_order_tickets = isset( $CFG->EED_Events_Archive->display_order_tickets ) && $config->use_sortable_display_order |
|
173 | + $config->display_order_tickets = isset($CFG->EED_Events_Archive->display_order_tickets) && $config->use_sortable_display_order |
|
174 | 174 | ? $CFG->EED_Events_Archive->display_order_tickets |
175 | 175 | : EED_Events_Archive::EVENT_TICKETS_PRIORITY; |
176 | - $config->display_order_venue = isset( $CFG->EED_Events_Archive->display_order_venue ) && $config->use_sortable_display_order |
|
176 | + $config->display_order_venue = isset($CFG->EED_Events_Archive->display_order_venue) && $config->use_sortable_display_order |
|
177 | 177 | ? $CFG->EED_Events_Archive->display_order_venue |
178 | 178 | : EED_Events_Archive::EVENT_VENUES_PRIORITY; |
179 | 179 | } |
180 | 180 | $CFG->EED_Events_Archive = $config; |
181 | - do_action( 'AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ ); |
|
181 | + do_action('AHEE__EED_Events_Archive__update_template_settings__after_update', $CFG, $REQ); |
|
182 | 182 | return $CFG; |
183 | 183 | } |
184 | 184 | |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public static function update_event_archive_order() { |
194 | 194 | $config_saved = false; |
195 | - $template_parts = sanitize_text_field( $_POST[ 'elements' ] ); |
|
196 | - if ( ! empty( $template_parts ) ) { |
|
197 | - $template_parts = explode( ',', trim( $template_parts, ',' ) ); |
|
198 | - foreach ( $template_parts as $key => $template_part ) { |
|
195 | + $template_parts = sanitize_text_field($_POST['elements']); |
|
196 | + if ( ! empty($template_parts)) { |
|
197 | + $template_parts = explode(',', trim($template_parts, ',')); |
|
198 | + foreach ($template_parts as $key => $template_part) { |
|
199 | 199 | $template_part = "display_order_$template_part"; |
200 | - $priority = ( $key * 10 ) + EED_Events_Archive::EVENT_DETAILS_PRIORITY; |
|
200 | + $priority = ($key * 10) + EED_Events_Archive::EVENT_DETAILS_PRIORITY; |
|
201 | 201 | if ( |
202 | 202 | property_exists( |
203 | 203 | EE_Registry::instance()->CFG->template_settings->EED_Events_Archive, |
@@ -206,16 +206,16 @@ discard block |
||
206 | 206 | ) { |
207 | 207 | EE_Registry::instance()->CFG->template_settings->EED_Events_Archive->{$template_part} = $priority; |
208 | 208 | } |
209 | - do_action( "AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority ); |
|
209 | + do_action("AHEE__EED_Events_Archive__update_event_archive_order__$template_part", $priority); |
|
210 | 210 | } |
211 | - $config_saved = EE_Registry::instance()->CFG->update_espresso_config( false, false ); |
|
211 | + $config_saved = EE_Registry::instance()->CFG->update_espresso_config(false, false); |
|
212 | 212 | } |
213 | - if ( $config_saved ) { |
|
214 | - EE_Error::add_success( __( 'Display Order has been successfully updated.', 'event_espresso' ) ); |
|
213 | + if ($config_saved) { |
|
214 | + EE_Error::add_success(__('Display Order has been successfully updated.', 'event_espresso')); |
|
215 | 215 | } else { |
216 | - EE_Error::add_error( __( 'Display Order was not updated.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
216 | + EE_Error::add_error(__('Display Order was not updated.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
217 | 217 | } |
218 | - echo wp_json_encode( EE_Error::get_notices( false ) ); |
|
218 | + echo wp_json_encode(EE_Error::get_notices(false)); |
|
219 | 219 | exit(); |
220 | 220 | } |
221 | 221 |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | protected function _get_billing_values_from_form( $billing_form ){ |
443 | 443 | if($billing_form instanceof EE_Form_Section_Proper ){ |
444 | 444 | return $billing_form->input_pretty_values( true ); |
445 | - }else{ |
|
445 | + } else{ |
|
446 | 446 | return NULL; |
447 | 447 | } |
448 | 448 | } |
@@ -550,7 +550,7 @@ discard block |
||
550 | 550 | public function supports_sending_refunds(){ |
551 | 551 | if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
552 | 552 | return $this->_gateway->supports_sending_refunds(); |
553 | - }else{ |
|
553 | + } else{ |
|
554 | 554 | return false; |
555 | 555 | } |
556 | 556 | } |
@@ -588,11 +588,11 @@ discard block |
||
588 | 588 | public function payment_occurs(){ |
589 | 589 | if( ! $this->_gateway){ |
590 | 590 | return EE_PMT_Base::offline; |
591 | - }elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
591 | + } elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
592 | 592 | return EE_PMT_Base::onsite; |
593 | - }elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
593 | + } elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
594 | 594 | return EE_PMT_Base::offsite; |
595 | - }else{ |
|
595 | + } else{ |
|
596 | 596 | throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"),get_class($this))); |
597 | 597 | } |
598 | 598 | } |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | $this->_gateway->set_template_helper( new EEH_Template() ); |
107 | 107 | $this->_gateway->set_line_item_helper( new EEH_Line_Item() ); |
108 | 108 | $this->_gateway->set_money_helper( new EEH_Money() ); |
109 | - $this->_gateway->set_gateway_data_formatter(new GatewayDataFormatter()); |
|
110 | - $this->_gateway->set_unsupported_character_remover(new AsciiOnly()); |
|
111 | - do_action( 'AHEE__EE_PMT_Base___construct__done_initializing_gateway_class',$this,$this->_gateway); |
|
109 | + $this->_gateway->set_gateway_data_formatter(new GatewayDataFormatter()); |
|
110 | + $this->_gateway->set_unsupported_character_remover(new AsciiOnly()); |
|
111 | + do_action( 'AHEE__EE_PMT_Base___construct__done_initializing_gateway_class',$this,$this->_gateway); |
|
112 | 112 | } |
113 | 113 | if ( ! isset( $this->_has_billing_form ) ) { |
114 | 114 | // by default, On Site gateways have a billing form |
@@ -282,17 +282,17 @@ discard block |
||
282 | 282 | //if we know who the attendee is, and this is a billing form |
283 | 283 | //that uses attendee info, populate it |
284 | 284 | if ( |
285 | - apply_filters( |
|
286 | - 'FHEE__populate_billing_form_fields_from_attendee', |
|
287 | - ( |
|
288 | - $this->_billing_form instanceof EE_Billing_Attendee_Info_Form |
|
289 | - && $transaction instanceof EE_Transaction |
|
290 | - && $transaction->primary_registration() instanceof EE_Registration |
|
291 | - && $transaction->primary_registration()->attendee() instanceof EE_Attendee |
|
292 | - ), |
|
293 | - $this->_billing_form, |
|
294 | - $transaction |
|
295 | - ) |
|
285 | + apply_filters( |
|
286 | + 'FHEE__populate_billing_form_fields_from_attendee', |
|
287 | + ( |
|
288 | + $this->_billing_form instanceof EE_Billing_Attendee_Info_Form |
|
289 | + && $transaction instanceof EE_Transaction |
|
290 | + && $transaction->primary_registration() instanceof EE_Registration |
|
291 | + && $transaction->primary_registration()->attendee() instanceof EE_Attendee |
|
292 | + ), |
|
293 | + $this->_billing_form, |
|
294 | + $transaction |
|
295 | + ) |
|
296 | 296 | ){ |
297 | 297 | $this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() ); |
298 | 298 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @since $VID:$ |
17 | 17 | * |
18 | 18 | */ |
19 | -abstract class EE_PMT_Base{ |
|
19 | +abstract class EE_PMT_Base { |
|
20 | 20 | |
21 | 21 | const onsite = 'on-site'; |
22 | 22 | const offsite = 'off-site'; |
@@ -97,34 +97,34 @@ discard block |
||
97 | 97 | * @return EE_PMT_Base |
98 | 98 | */ |
99 | 99 | function __construct($pm_instance = NULL) { |
100 | - if ( $pm_instance instanceof EE_Payment_Method ){ |
|
100 | + if ($pm_instance instanceof EE_Payment_Method) { |
|
101 | 101 | $this->set_instance($pm_instance); |
102 | 102 | } |
103 | - if($this->_gateway){ |
|
104 | - $this->_gateway->set_payment_model( EEM_Payment::instance() ); |
|
105 | - $this->_gateway->set_payment_log( EEM_Change_Log::instance() ); |
|
106 | - $this->_gateway->set_template_helper( new EEH_Template() ); |
|
107 | - $this->_gateway->set_line_item_helper( new EEH_Line_Item() ); |
|
108 | - $this->_gateway->set_money_helper( new EEH_Money() ); |
|
103 | + if ($this->_gateway) { |
|
104 | + $this->_gateway->set_payment_model(EEM_Payment::instance()); |
|
105 | + $this->_gateway->set_payment_log(EEM_Change_Log::instance()); |
|
106 | + $this->_gateway->set_template_helper(new EEH_Template()); |
|
107 | + $this->_gateway->set_line_item_helper(new EEH_Line_Item()); |
|
108 | + $this->_gateway->set_money_helper(new EEH_Money()); |
|
109 | 109 | $this->_gateway->set_gateway_data_formatter(new GatewayDataFormatter()); |
110 | 110 | $this->_gateway->set_unsupported_character_remover(new AsciiOnly()); |
111 | - do_action( 'AHEE__EE_PMT_Base___construct__done_initializing_gateway_class',$this,$this->_gateway); |
|
111 | + do_action('AHEE__EE_PMT_Base___construct__done_initializing_gateway_class', $this, $this->_gateway); |
|
112 | 112 | } |
113 | - if ( ! isset( $this->_has_billing_form ) ) { |
|
113 | + if ( ! isset($this->_has_billing_form)) { |
|
114 | 114 | // by default, On Site gateways have a billing form |
115 | - if ( $this->payment_occurs() == EE_PMT_Base::onsite ) { |
|
116 | - $this->set_has_billing_form( true ); |
|
115 | + if ($this->payment_occurs() == EE_PMT_Base::onsite) { |
|
116 | + $this->set_has_billing_form(true); |
|
117 | 117 | } else { |
118 | - $this->set_has_billing_form( false ); |
|
118 | + $this->set_has_billing_form(false); |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
122 | - if( ! $this->_pretty_name){ |
|
122 | + if ( ! $this->_pretty_name) { |
|
123 | 123 | throw new EE_Error(sprintf(__("You must set the pretty name for the Payment Method Type in the constructor (_pretty_name), and please make it internationalized", "event_espresso"))); |
124 | 124 | } |
125 | 125 | //if the child didn't specify a default button, use the credit card one |
126 | - if( $this->_default_button_url === NULL){ |
|
127 | - $this->_default_button_url = EE_PLUGIN_DIR_URL . 'payment_methods' . DS . 'pay-by-credit-card.png'; |
|
126 | + if ($this->_default_button_url === NULL) { |
|
127 | + $this->_default_button_url = EE_PLUGIN_DIR_URL.'payment_methods'.DS.'pay-by-credit-card.png'; |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
@@ -133,8 +133,8 @@ discard block |
||
133 | 133 | /** |
134 | 134 | * @param boolean $has_billing_form |
135 | 135 | */ |
136 | - public function set_has_billing_form( $has_billing_form ) { |
|
137 | - $this->_has_billing_form = filter_var( $has_billing_form, FILTER_VALIDATE_BOOLEAN ); |
|
136 | + public function set_has_billing_form($has_billing_form) { |
|
137 | + $this->_has_billing_form = filter_var($has_billing_form, FILTER_VALIDATE_BOOLEAN); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -142,10 +142,10 @@ discard block |
||
142 | 142 | /** |
143 | 143 | * sets the file_folder property |
144 | 144 | */ |
145 | - protected function _set_file_folder(){ |
|
145 | + protected function _set_file_folder() { |
|
146 | 146 | $reflector = new ReflectionClass(get_class($this)); |
147 | 147 | $fn = $reflector->getFileName(); |
148 | - $this->_file_folder = dirname($fn).DS; |
|
148 | + $this->_file_folder = dirname($fn).DS; |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -153,10 +153,10 @@ discard block |
||
153 | 153 | /** |
154 | 154 | * sets the file URL with a trailing slash for this PMT |
155 | 155 | */ |
156 | - protected function _set_file_url(){ |
|
157 | - $plugins_dir_fixed = str_replace('\\',DS,WP_PLUGIN_DIR); |
|
158 | - $file_folder_fixed = str_replace('\\',DS,$this->file_folder()); |
|
159 | - $file_path = str_replace($plugins_dir_fixed,WP_PLUGIN_URL,$file_folder_fixed); |
|
156 | + protected function _set_file_url() { |
|
157 | + $plugins_dir_fixed = str_replace('\\', DS, WP_PLUGIN_DIR); |
|
158 | + $file_folder_fixed = str_replace('\\', DS, $this->file_folder()); |
|
159 | + $file_path = str_replace($plugins_dir_fixed, WP_PLUGIN_URL, $file_folder_fixed); |
|
160 | 160 | $this->_file_url = $file_path; |
161 | 161 | } |
162 | 162 | |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | * Gets the default description on all payment methods of this type |
165 | 165 | * @return string |
166 | 166 | */ |
167 | - public function default_description(){ |
|
167 | + public function default_description() { |
|
168 | 168 | return $this->_default_description; |
169 | 169 | } |
170 | 170 | |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * Returns the folder containing the PMT child class, with a trailing slash |
175 | 175 | * @return string |
176 | 176 | */ |
177 | - public function file_folder(){ |
|
178 | - if( ! $this->_file_folder ) { |
|
177 | + public function file_folder() { |
|
178 | + if ( ! $this->_file_folder) { |
|
179 | 179 | $this->_set_file_folder(); |
180 | 180 | } |
181 | 181 | return $this->_file_folder; |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | /** |
187 | 187 | * @return string |
188 | 188 | */ |
189 | - public function file_url(){ |
|
190 | - if( ! $this->_file_url ) { |
|
189 | + public function file_url() { |
|
190 | + if ( ! $this->_file_url) { |
|
191 | 191 | $this->_set_file_url(); |
192 | 192 | } |
193 | 193 | return $this->_file_url; |
@@ -200,14 +200,14 @@ discard block |
||
200 | 200 | * Its important teh payment method instance is set before |
201 | 201 | * @param EE_Payment_Method $payment_method_instance |
202 | 202 | */ |
203 | - function set_instance($payment_method_instance){ |
|
203 | + function set_instance($payment_method_instance) { |
|
204 | 204 | $this->_pm_instance = $payment_method_instance; |
205 | 205 | //if they have already requested the settings form, make sure its |
206 | 206 | //data matches this model object |
207 | - if($this->_settings_form){ |
|
207 | + if ($this->_settings_form) { |
|
208 | 208 | $this->settings_form()->populate_model_obj($payment_method_instance); |
209 | 209 | } |
210 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
210 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
211 | 211 | $this->_gateway->set_settings($payment_method_instance->settings_array()); |
212 | 212 | } |
213 | 213 | } |
@@ -218,13 +218,13 @@ discard block |
||
218 | 218 | * Gets teh form for displaying to admins where they setup the payment method |
219 | 219 | * @return EE_Payment_Method_Form |
220 | 220 | */ |
221 | - function settings_form(){ |
|
222 | - if( ! $this->_settings_form){ |
|
221 | + function settings_form() { |
|
222 | + if ( ! $this->_settings_form) { |
|
223 | 223 | $this->_settings_form = $this->generate_new_settings_form(); |
224 | - $this->_settings_form->set_payment_method_type( $this ); |
|
224 | + $this->_settings_form->set_payment_method_type($this); |
|
225 | 225 | //if we have already assigned a model object to this pmt, make |
226 | 226 | //sure its reflected in teh form we just generated |
227 | - if($this->_pm_instance){ |
|
227 | + if ($this->_pm_instance) { |
|
228 | 228 | $this->_settings_form->populate_model_obj($this->_pm_instance); |
229 | 229 | } |
230 | 230 | } |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * this payment method type's settings form later in the request |
251 | 251 | * @param EE_Payment_Method_Form $form |
252 | 252 | */ |
253 | - public function set_settings_form($form){ |
|
253 | + public function set_settings_form($form) { |
|
254 | 254 | $this->_settings_form = $form; |
255 | 255 | } |
256 | 256 | |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | * @param array $extra_args |
274 | 274 | * @return \EE_Billing_Attendee_Info_Form|\EE_Billing_Info_Form|null |
275 | 275 | */ |
276 | - public function billing_form( EE_Transaction $transaction = NULL, $extra_args = array() ){ |
|
276 | + public function billing_form(EE_Transaction $transaction = NULL, $extra_args = array()) { |
|
277 | 277 | // has billing form already been regenerated ? or overwrite cache? |
278 | - if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form ){ |
|
279 | - $this->_billing_form = $this->generate_new_billing_form( $transaction, $extra_args ); |
|
278 | + if ( ! $this->_billing_form instanceof EE_Billing_Info_Form || ! $this->_cache_billing_form) { |
|
279 | + $this->_billing_form = $this->generate_new_billing_form($transaction, $extra_args); |
|
280 | 280 | } |
281 | 281 | //if we know who the attendee is, and this is a billing form |
282 | 282 | //that uses attendee info, populate it |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | $this->_billing_form, |
293 | 293 | $transaction |
294 | 294 | ) |
295 | - ){ |
|
296 | - $this->_billing_form->populate_from_attendee( $transaction->primary_registration()->attendee() ); |
|
295 | + ) { |
|
296 | + $this->_billing_form->populate_from_attendee($transaction->primary_registration()->attendee()); |
|
297 | 297 | } |
298 | 298 | return $this->_billing_form; |
299 | 299 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | * @param \EE_Transaction $transaction |
305 | 305 | * @return \EE_Billing_Info_Form |
306 | 306 | */ |
307 | - abstract function generate_new_billing_form( EE_Transaction $transaction = NULL ); |
|
307 | + abstract function generate_new_billing_form(EE_Transaction $transaction = NULL); |
|
308 | 308 | |
309 | 309 | |
310 | 310 | |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * @param \EE_Billing_Info_Form $billing_form |
316 | 316 | * @return \EE_Billing_Info_Form |
317 | 317 | */ |
318 | - public function apply_billing_form_debug_settings( EE_Billing_Info_Form $billing_form ) { |
|
318 | + public function apply_billing_form_debug_settings(EE_Billing_Info_Form $billing_form) { |
|
319 | 319 | return $billing_form; |
320 | 320 | } |
321 | 321 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * if you have form |
327 | 327 | * @param EE_Payment_Method $form |
328 | 328 | */ |
329 | - public function set_billing_form($form){ |
|
329 | + public function set_billing_form($form) { |
|
330 | 330 | $this->_billing_form = $form; |
331 | 331 | } |
332 | 332 | |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | * Returns whether or not this payment method requires HTTPS to be used |
337 | 337 | * @return boolean |
338 | 338 | */ |
339 | - function requires_https(){ |
|
339 | + function requires_https() { |
|
340 | 340 | return $this->_requires_https; |
341 | 341 | } |
342 | 342 | |
@@ -354,9 +354,9 @@ discard block |
||
354 | 354 | * @return EE_Payment |
355 | 355 | * @throws EE_Error |
356 | 356 | */ |
357 | - function process_payment( EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null,$fail_url = '', $method = 'CART', $by_admin = false ){ |
|
357 | + function process_payment(EE_Transaction $transaction, $amount = null, $billing_info = null, $return_url = null, $fail_url = '', $method = 'CART', $by_admin = false) { |
|
358 | 358 | // @todo: add surcharge for the payment method, if any |
359 | - if ( $this->_gateway ) { |
|
359 | + if ($this->_gateway) { |
|
360 | 360 | //there is a gateway, so we're going to make a payment object |
361 | 361 | //but wait! do they already have a payment in progress that we thought was failed? |
362 | 362 | $duplicate_properties = array( |
@@ -367,10 +367,10 @@ discard block |
||
367 | 367 | 'PAY_amount' => $amount !== null ? $amount : $transaction->remaining(), |
368 | 368 | 'PAY_gateway_response' => null, |
369 | 369 | ); |
370 | - $payment = EEM_Payment::instance()->get_one( array( $duplicate_properties )); |
|
370 | + $payment = EEM_Payment::instance()->get_one(array($duplicate_properties)); |
|
371 | 371 | //if we didn't already have a payment in progress for the same thing, |
372 | 372 | //then we actually want to make a new payment |
373 | - if ( ! $payment instanceof EE_Payment ){ |
|
373 | + if ( ! $payment instanceof EE_Payment) { |
|
374 | 374 | $payment = EE_Payment::new_instance( |
375 | 375 | array_merge( |
376 | 376 | $duplicate_properties, |
@@ -386,10 +386,10 @@ discard block |
||
386 | 386 | } |
387 | 387 | //make sure the payment has been saved to show we started it, and so it has an ID should the gateway try to log it |
388 | 388 | $payment->save(); |
389 | - $billing_values = $this->_get_billing_values_from_form( $billing_info ); |
|
389 | + $billing_values = $this->_get_billing_values_from_form($billing_info); |
|
390 | 390 | |
391 | 391 | // Offsite Gateway |
392 | - if( $this->_gateway instanceof EE_Offsite_Gateway ){ |
|
392 | + if ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
393 | 393 | |
394 | 394 | $payment = $this->_gateway->set_redirection_info( |
395 | 395 | $payment, |
@@ -405,17 +405,17 @@ discard block |
||
405 | 405 | ); |
406 | 406 | $payment->save(); |
407 | 407 | // Onsite Gateway |
408 | - } elseif ( $this->_gateway instanceof EE_Onsite_Gateway ) { |
|
408 | + } elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
409 | 409 | |
410 | - $payment = $this->_gateway->do_direct_payment($payment,$billing_values); |
|
410 | + $payment = $this->_gateway->do_direct_payment($payment, $billing_values); |
|
411 | 411 | $payment->save(); |
412 | 412 | |
413 | 413 | } else { |
414 | 414 | throw new EE_Error( |
415 | 415 | sprintf( |
416 | - __('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso' ), |
|
416 | + __('Gateway for payment method type "%s" is "%s", not a subclass of either EE_Offsite_Gateway or EE_Onsite_Gateway, or null (to indicate NO gateway)', 'event_espresso'), |
|
417 | 417 | get_class($this), |
418 | - gettype( $this->_gateway ) |
|
418 | + gettype($this->_gateway) |
|
419 | 419 | ) |
420 | 420 | ); |
421 | 421 | } |
@@ -437,8 +437,8 @@ discard block |
||
437 | 437 | } |
438 | 438 | |
439 | 439 | // if there is billing info, clean it and save it now |
440 | - if( $billing_info instanceof EE_Billing_Attendee_Info_Form ){ |
|
441 | - $this->_save_billing_info_to_attendee( $billing_info, $transaction ); |
|
440 | + if ($billing_info instanceof EE_Billing_Attendee_Info_Form) { |
|
441 | + $this->_save_billing_info_to_attendee($billing_info, $transaction); |
|
442 | 442 | } |
443 | 443 | |
444 | 444 | return $payment; |
@@ -451,10 +451,10 @@ discard block |
||
451 | 451 | * @param EE_Billing_Info_Form $billing_form |
452 | 452 | * @return array |
453 | 453 | */ |
454 | - protected function _get_billing_values_from_form( $billing_form ){ |
|
455 | - if($billing_form instanceof EE_Form_Section_Proper ){ |
|
456 | - return $billing_form->input_pretty_values( true ); |
|
457 | - }else{ |
|
454 | + protected function _get_billing_values_from_form($billing_form) { |
|
455 | + if ($billing_form instanceof EE_Form_Section_Proper) { |
|
456 | + return $billing_form->input_pretty_values(true); |
|
457 | + } else { |
|
458 | 458 | return NULL; |
459 | 459 | } |
460 | 460 | } |
@@ -468,13 +468,13 @@ discard block |
||
468 | 468 | * @return EE_Payment |
469 | 469 | * @throws EE_Error |
470 | 470 | */ |
471 | - public function handle_ipn($req_data,$transaction){ |
|
471 | + public function handle_ipn($req_data, $transaction) { |
|
472 | 472 | $transaction = EEM_Transaction::instance()->ensure_is_obj($transaction); |
473 | - if( ! $this->_gateway instanceof EE_Offsite_Gateway){ |
|
474 | - throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r( $this->_gateway, TRUE ))); |
|
473 | + if ( ! $this->_gateway instanceof EE_Offsite_Gateway) { |
|
474 | + throw new EE_Error(sprintf(__("Could not handle IPN because '%s' is not an offsite gateway", "event_espresso"), print_r($this->_gateway, TRUE))); |
|
475 | 475 | |
476 | 476 | } |
477 | - $payment = $this->_gateway->handle_payment_update( $req_data, $transaction ); |
|
477 | + $payment = $this->_gateway->handle_payment_update($req_data, $transaction); |
|
478 | 478 | return $payment; |
479 | 479 | } |
480 | 480 | |
@@ -487,22 +487,22 @@ discard block |
||
487 | 487 | * @param EE_Transaction $transaction |
488 | 488 | * @return boolean success |
489 | 489 | */ |
490 | - protected function _save_billing_info_to_attendee($billing_form, $transaction){ |
|
491 | - if( ! $transaction || ! $transaction instanceof EE_Transaction){ |
|
490 | + protected function _save_billing_info_to_attendee($billing_form, $transaction) { |
|
491 | + if ( ! $transaction || ! $transaction instanceof EE_Transaction) { |
|
492 | 492 | EE_Error::add_error(__("Cannot save billing info because no transaction was specified", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
493 | 493 | return false; |
494 | 494 | } |
495 | 495 | $primary_reg = $transaction->primary_registration(); |
496 | - if( ! $primary_reg ){ |
|
496 | + if ( ! $primary_reg) { |
|
497 | 497 | EE_Error::add_error(__("Cannot save billing info because the transaction has no primary registration", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
498 | 498 | return false; |
499 | 499 | } |
500 | 500 | $attendee = $primary_reg->attendee(); |
501 | - if( ! $attendee ){ |
|
501 | + if ( ! $attendee) { |
|
502 | 502 | EE_Error::add_error(__("Cannot save billing info because the transaction's primary registration has no attendee!", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
503 | 503 | return false; |
504 | 504 | } |
505 | - return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method() ); |
|
505 | + return $attendee->save_and_clean_billing_info_for_payment_method($billing_form, $transaction->payment_method()); |
|
506 | 506 | |
507 | 507 | } |
508 | 508 | |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | * @param array $req_data |
516 | 516 | * @return EE_Payment |
517 | 517 | */ |
518 | - protected function find_payment_for_ipn( EE_Transaction $transaction, $req_data = array() ){ |
|
518 | + protected function find_payment_for_ipn(EE_Transaction $transaction, $req_data = array()) { |
|
519 | 519 | return $transaction->last_payment(); |
520 | 520 | } |
521 | 521 | |
@@ -532,8 +532,8 @@ discard block |
||
532 | 532 | * and identifies the IPN as being for this payment method (not just fo ra payment method of this type) |
533 | 533 | * @throws EE_Error |
534 | 534 | */ |
535 | - public function handle_unclaimed_ipn( $req_data = array() ){ |
|
536 | - throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this) )); |
|
535 | + public function handle_unclaimed_ipn($req_data = array()) { |
|
536 | + throw new EE_Error(sprintf(__("Payment Method '%s' cannot handle unclaimed IPNs", "event_espresso"), get_class($this))); |
|
537 | 537 | } |
538 | 538 | |
539 | 539 | |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | * @param EE_Transaction $transaction |
550 | 550 | * @return EE_Payment |
551 | 551 | */ |
552 | - public function finalize_payment_for($transaction){ |
|
552 | + public function finalize_payment_for($transaction) { |
|
553 | 553 | return $transaction->last_payment(); |
554 | 554 | } |
555 | 555 | |
@@ -559,10 +559,10 @@ discard block |
||
559 | 559 | * Whether or not this payment method's gateway supports sending refund requests |
560 | 560 | * @return boolean |
561 | 561 | */ |
562 | - public function supports_sending_refunds(){ |
|
563 | - if($this->_gateway && $this->_gateway instanceof EE_Gateway){ |
|
562 | + public function supports_sending_refunds() { |
|
563 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
564 | 564 | return $this->_gateway->supports_sending_refunds(); |
565 | - }else{ |
|
565 | + } else { |
|
566 | 566 | return false; |
567 | 567 | } |
568 | 568 | } |
@@ -576,14 +576,14 @@ discard block |
||
576 | 576 | * @throws EE_Error |
577 | 577 | * @return EE_Payment |
578 | 578 | */ |
579 | - public function process_refund( EE_Payment $payment, $refund_info = array()){ |
|
580 | - if ( $this->_gateway && $this->_gateway instanceof EE_Gateway ) { |
|
581 | - return $this->_gateway->do_direct_refund( $payment, $refund_info ); |
|
579 | + public function process_refund(EE_Payment $payment, $refund_info = array()) { |
|
580 | + if ($this->_gateway && $this->_gateway instanceof EE_Gateway) { |
|
581 | + return $this->_gateway->do_direct_refund($payment, $refund_info); |
|
582 | 582 | } else { |
583 | 583 | throw new EE_Error( |
584 | 584 | sprintf( |
585 | - __( 'Payment Method Type "%s" does not support sending refund requests', 'event_espresso' ), |
|
586 | - get_class( $this ) |
|
585 | + __('Payment Method Type "%s" does not support sending refund requests', 'event_espresso'), |
|
586 | + get_class($this) |
|
587 | 587 | ) |
588 | 588 | ); |
589 | 589 | } |
@@ -597,15 +597,15 @@ discard block |
||
597 | 597 | * @return string |
598 | 598 | * @throws EE_Error |
599 | 599 | */ |
600 | - public function payment_occurs(){ |
|
601 | - if( ! $this->_gateway){ |
|
600 | + public function payment_occurs() { |
|
601 | + if ( ! $this->_gateway) { |
|
602 | 602 | return EE_PMT_Base::offline; |
603 | - }elseif($this->_gateway instanceof EE_Onsite_Gateway){ |
|
603 | + }elseif ($this->_gateway instanceof EE_Onsite_Gateway) { |
|
604 | 604 | return EE_PMT_Base::onsite; |
605 | - }elseif($this->_gateway instanceof EE_Offsite_Gateway){ |
|
605 | + }elseif ($this->_gateway instanceof EE_Offsite_Gateway) { |
|
606 | 606 | return EE_PMT_Base::offsite; |
607 | - }else{ |
|
608 | - throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"),get_class($this))); |
|
607 | + } else { |
|
608 | + throw new EE_Error(sprintf(__("Payment method type '%s's gateway isn't an instance of EE_Onsite_Gateway, EE_Offsite_Gateway, or null. It must be one of those", "event_espresso"), get_class($this))); |
|
609 | 609 | } |
610 | 610 | } |
611 | 611 | |
@@ -618,8 +618,8 @@ discard block |
||
618 | 618 | * @param EE_Payment $payment |
619 | 619 | * @return string |
620 | 620 | */ |
621 | - public function payment_overview_content(EE_Payment $payment){ |
|
622 | - return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance,'payment'=>$payment) , true); |
|
621 | + public function payment_overview_content(EE_Payment $payment) { |
|
622 | + return EEH_Template::display_template(EE_LIBRARIES.'payment_methods'.DS.'templates'.DS.'payment_details_content.template.php', array('payment_method'=>$this->_pm_instance, 'payment'=>$payment), true); |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @type array $template_args any arguments you want passed to the template file while rendering. |
633 | 633 | * Keys will be variable names and values with be their values. |
634 | 634 | */ |
635 | - public function help_tabs_config(){ |
|
635 | + public function help_tabs_config() { |
|
636 | 636 | return array(); |
637 | 637 | } |
638 | 638 | |
@@ -643,9 +643,9 @@ discard block |
||
643 | 643 | * the payment method's table's PMT_type column) |
644 | 644 | * @return string |
645 | 645 | */ |
646 | - public function system_name(){ |
|
646 | + public function system_name() { |
|
647 | 647 | $classname = get_class($this); |
648 | - return str_replace("EE_PMT_",'',$classname); |
|
648 | + return str_replace("EE_PMT_", '', $classname); |
|
649 | 649 | } |
650 | 650 | |
651 | 651 | |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | * A pretty i18n version of the PMT name |
655 | 655 | * @return string |
656 | 656 | */ |
657 | - public function pretty_name(){ |
|
657 | + public function pretty_name() { |
|
658 | 658 | return $this->_pretty_name; |
659 | 659 | } |
660 | 660 | |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | * Gets the default absolute URL to the payment method type's button |
665 | 665 | * @return string |
666 | 666 | */ |
667 | - public function default_button_url(){ |
|
667 | + public function default_button_url() { |
|
668 | 668 | return $this->_default_button_url; |
669 | 669 | } |
670 | 670 | |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | * Gets the gateway used by this payment method (if any) |
675 | 675 | * @return EE_Gateway |
676 | 676 | */ |
677 | - public function get_gateway(){ |
|
677 | + public function get_gateway() { |
|
678 | 678 | return $this->_gateway; |
679 | 679 | } |
680 | 680 | |
@@ -683,8 +683,8 @@ discard block |
||
683 | 683 | /** |
684 | 684 | * @return string html for the link to a help tab |
685 | 685 | */ |
686 | - public function get_help_tab_link(){ |
|
687 | - return EEH_Template::get_help_tab_link( $this->get_help_tab_name() ); |
|
686 | + public function get_help_tab_link() { |
|
687 | + return EEH_Template::get_help_tab_link($this->get_help_tab_name()); |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | |
@@ -693,8 +693,8 @@ discard block |
||
693 | 693 | * Returns the name of the help tab for this PMT |
694 | 694 | * @return string |
695 | 695 | */ |
696 | - public function get_help_tab_name(){ |
|
697 | - return 'ee_' . strtolower( $this->system_name() ) . '_help_tab'; |
|
696 | + public function get_help_tab_name() { |
|
697 | + return 'ee_'.strtolower($this->system_name()).'_help_tab'; |
|
698 | 698 | } |
699 | 699 | |
700 | 700 | /** |
@@ -702,8 +702,8 @@ discard block |
||
702 | 702 | * this PMT by an admin |
703 | 703 | * @return string |
704 | 704 | */ |
705 | - public function cap_name(){ |
|
706 | - return 'ee_payment_method_' . strtolower( $this->system_name() ); |
|
705 | + public function cap_name() { |
|
706 | + return 'ee_payment_method_'.strtolower($this->system_name()); |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | /** |
@@ -715,9 +715,9 @@ discard block |
||
715 | 715 | * @param EE_Payment $payment |
716 | 716 | * @return void |
717 | 717 | */ |
718 | - public function update_txn_based_on_payment( $payment ){ |
|
719 | - if( $this->_gateway instanceof EE_Gateway ){ |
|
720 | - $this->_gateway->update_txn_based_on_payment( $payment ); |
|
718 | + public function update_txn_based_on_payment($payment) { |
|
719 | + if ($this->_gateway instanceof EE_Gateway) { |
|
720 | + $this->_gateway->update_txn_based_on_payment($payment); |
|
721 | 721 | } |
722 | 722 | } |
723 | 723 | |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | * @return string |
733 | 733 | */ |
734 | 734 | public function introductory_html() { |
735 | - return EEH_Template::locate_template( $this->file_folder() . 'templates' . DS . strtolower( $this->system_name() ) . '_intro.template.php', array( 'pmt_obj' => $this, 'pm_instance' => $this->_pm_instance ) ); |
|
735 | + return EEH_Template::locate_template($this->file_folder().'templates'.DS.strtolower($this->system_name()).'_intro.template.php', array('pmt_obj' => $this, 'pm_instance' => $this->_pm_instance)); |
|
736 | 736 | } |
737 | 737 | |
738 | 738 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //namespace EventEspresso\core\libraries\templates; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * Class EE_Template_Part |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | * @param string $template |
48 | 48 | * @param int $priority |
49 | 49 | */ |
50 | - public function __construct( $name, $label, $template, $priority = 100 ) { |
|
51 | - $this->set_name( $name ); |
|
52 | - $this->set_label( $label ); |
|
53 | - $this->set_template( $template ); |
|
54 | - $this->set_priority( $priority ); |
|
50 | + public function __construct($name, $label, $template, $priority = 100) { |
|
51 | + $this->set_name($name); |
|
52 | + $this->set_label($label); |
|
53 | + $this->set_template($template); |
|
54 | + $this->set_priority($priority); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | /** |
69 | 69 | * @param mixed $name |
70 | 70 | */ |
71 | - public function set_name( $name ) { |
|
71 | + public function set_name($name) { |
|
72 | 72 | $this->name = $name; |
73 | 73 | } |
74 | 74 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | /** |
87 | 87 | * @param string $label |
88 | 88 | */ |
89 | - public function set_label( $label ) { |
|
89 | + public function set_label($label) { |
|
90 | 90 | $this->label = $label; |
91 | 91 | } |
92 | 92 | |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * @param string $template |
106 | 106 | */ |
107 | - public function set_template( $template ) { |
|
107 | + public function set_template($template) { |
|
108 | 108 | $this->template = $template; |
109 | 109 | } |
110 | 110 | |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | /** |
123 | 123 | * @param int $priority |
124 | 124 | */ |
125 | - public function set_priority( $priority ) { |
|
126 | - $this->priority = intval( $priority ); |
|
125 | + public function set_priority($priority) { |
|
126 | + $this->priority = intval($priority); |
|
127 | 127 | } |
128 | 128 | |
129 | 129 |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | //namespace EventEspresso\core\libraries\templates; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * Class EE_Template_Part_PriorityQueue |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | * @param int $priority |
32 | 32 | * @return bool |
33 | 33 | */ |
34 | - public function insert( $object, $priority = 100 ) { |
|
35 | - if ( $object instanceof EE_Template_Part ) { |
|
36 | - parent::insert( $object, $priority ); |
|
34 | + public function insert($object, $priority = 100) { |
|
35 | + if ($object instanceof EE_Template_Part) { |
|
36 | + parent::insert($object, $priority); |
|
37 | 37 | return true; |
38 | 38 | } else { |
39 | 39 | return false; |
@@ -52,8 +52,8 @@ discard block |
||
52 | 52 | * @param int $priority2 |
53 | 53 | * @return bool |
54 | 54 | */ |
55 | - public function compare( $priority1, $priority2 ) { |
|
56 | - if ( $priority1 === $priority2 ) { |
|
55 | + public function compare($priority1, $priority2) { |
|
56 | + if ($priority1 === $priority2) { |
|
57 | 57 | return 0; |
58 | 58 | } |
59 | 59 | return $priority1 > $priority2 ? -1 : 1; |