@@ -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 | |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param EE_Messenger_Collection $messengers |
34 | 34 | */ |
35 | - public function __construct( EE_Messenger_Collection $messengers ) { |
|
36 | - $this->set_messenger_collection( $messengers ); |
|
35 | + public function __construct(EE_Messenger_Collection $messengers) { |
|
36 | + $this->set_messenger_collection($messengers); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * @param mixed $messengers |
52 | 52 | */ |
53 | - public function set_messenger_collection( EE_Messenger_Collection $messengers ) { |
|
53 | + public function set_messenger_collection(EE_Messenger_Collection $messengers) { |
|
54 | 54 | $this->_messenger_collection = $messengers; |
55 | 55 | } |
56 | 56 | |
@@ -63,41 +63,41 @@ discard block |
||
63 | 63 | * @param string $folder |
64 | 64 | * @throws \EE_Error |
65 | 65 | */ |
66 | - public function load_messengers_from_folder( $folder = '' ) { |
|
66 | + public function load_messengers_from_folder($folder = '') { |
|
67 | 67 | //make sure autoloaders are set (fail-safe) |
68 | 68 | EED_Messages::set_autoloaders(); |
69 | - $folder = ! empty( $folder ) ? $folder : EE_LIBRARIES . 'messages' . DS . 'messenger'; |
|
70 | - $folder .= $folder[ strlen( $folder ) - 1 ] != DS ? DS : ''; |
|
69 | + $folder = ! empty($folder) ? $folder : EE_LIBRARIES.'messages'.DS.'messenger'; |
|
70 | + $folder .= $folder[strlen($folder) - 1] != DS ? DS : ''; |
|
71 | 71 | // get all the files in that folder that end in ".class.php |
72 | 72 | $filepaths = apply_filters( |
73 | 73 | 'FHEE__EE_messages__get_installed__messenger_files', |
74 | - glob( $folder . '*.class.php' ) |
|
74 | + glob($folder.'*.class.php') |
|
75 | 75 | ); |
76 | - if ( empty( $filepaths ) ) { |
|
76 | + if (empty($filepaths)) { |
|
77 | 77 | return; |
78 | 78 | } |
79 | - foreach ( (array) $filepaths as $file_path ) { |
|
79 | + foreach ((array) $filepaths as $file_path) { |
|
80 | 80 | // extract filename from path |
81 | - $file_path = basename( $file_path ); |
|
81 | + $file_path = basename($file_path); |
|
82 | 82 | // now remove any file extensions |
83 | - $messenger_class_name = substr( $file_path, 0, strpos( $file_path, '.' ) ); |
|
83 | + $messenger_class_name = substr($file_path, 0, strpos($file_path, '.')); |
|
84 | 84 | |
85 | 85 | //first check to see if the class name represents an actual messenger class. |
86 | - if ( strpos( strtolower( $messenger_class_name ), 'messenger' ) === false ) { |
|
86 | + if (strpos(strtolower($messenger_class_name), 'messenger') === false) { |
|
87 | 87 | continue; |
88 | 88 | } |
89 | 89 | |
90 | - if ( ! class_exists( $messenger_class_name ) ) { |
|
90 | + if ( ! class_exists($messenger_class_name)) { |
|
91 | 91 | throw new EE_Error( |
92 | 92 | sprintf( |
93 | - __( 'The "%1$s" messenger class can\'t be loaded from %2$s. Likely there is a typo in the class name or the file name.', 'event_espresso' ), |
|
93 | + __('The "%1$s" messenger class can\'t be loaded from %2$s. Likely there is a typo in the class name or the file name.', 'event_espresso'), |
|
94 | 94 | $messenger_class_name, |
95 | 95 | $file_path |
96 | 96 | ) |
97 | 97 | ); |
98 | 98 | } |
99 | 99 | |
100 | - $this->_load_messenger( new $messenger_class_name() ); |
|
100 | + $this->_load_messenger(new $messenger_class_name()); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -113,10 +113,10 @@ discard block |
||
113 | 113 | EED_Messages::set_autoloaders(); |
114 | 114 | $active_messengers = apply_filters( |
115 | 115 | 'FHEE__EEH_MSG_Template__get_active_messengers_in_db', |
116 | - get_option( 'ee_active_messengers', array() ) |
|
116 | + get_option('ee_active_messengers', array()) |
|
117 | 117 | ); |
118 | - foreach ( (array) $active_messengers as $active_messenger_classname => $active_messenger ) { |
|
119 | - $this->_load_messenger( $active_messenger ); |
|
118 | + foreach ((array) $active_messengers as $active_messenger_classname => $active_messenger) { |
|
119 | + $this->_load_messenger($active_messenger); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | * @param \EE_messenger $messenger |
129 | 129 | * @return bool |
130 | 130 | */ |
131 | - protected function _load_messenger( EE_messenger $messenger ) { |
|
132 | - if ( $this->messenger_collection()->has_by_name( $messenger->name ) ) { |
|
131 | + protected function _load_messenger(EE_messenger $messenger) { |
|
132 | + if ($this->messenger_collection()->has_by_name($messenger->name)) { |
|
133 | 133 | return true; |
134 | 134 | } |
135 | 135 | return $this->messenger_collection()->add( |
@@ -51,26 +51,26 @@ |
||
51 | 51 | |
52 | 52 | |
53 | 53 | |
54 | - protected function _get_data_for_context( $context, EE_Registration $registration, $id ) { |
|
54 | + protected function _get_data_for_context($context, EE_Registration $registration, $id) { |
|
55 | 55 | |
56 | 56 | //use the registration to get the transaction. |
57 | 57 | $transaction = $registration->transaction(); |
58 | 58 | |
59 | 59 | //bail early if no transaction |
60 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
61 | - throw new EE_Error( __('The given registration does not have an associated transaction. Something is wrong.', 'event_espresso' ) ); |
|
60 | + if ( ! $transaction instanceof EE_Transaction) { |
|
61 | + throw new EE_Error(__('The given registration does not have an associated transaction. Something is wrong.', 'event_espresso')); |
|
62 | 62 | } |
63 | 63 | |
64 | - $payment = ! empty( $id ) ? EEM_Payment::instance()->get_one( array( array( 'PAY_ID' => $id, 'TXN_ID' => $transaction->ID() ) ) ) : 0; |
|
64 | + $payment = ! empty($id) ? EEM_Payment::instance()->get_one(array(array('PAY_ID' => $id, 'TXN_ID' => $transaction->ID()))) : 0; |
|
65 | 65 | |
66 | - return array( $transaction, $payment ); |
|
66 | + return array($transaction, $payment); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
70 | 70 | |
71 | - protected function _get_admin_content_events_edit_for_messenger( EE_messenger $messenger ) { |
|
71 | + protected function _get_admin_content_events_edit_for_messenger(EE_messenger $messenger) { |
|
72 | 72 | //this is just a test |
73 | - return $this->name . ' Message Type for ' . $messenger->name . ' Messenger '; |
|
73 | + return $this->name.' Message Type for '.$messenger->name.' Messenger '; |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -38,35 +38,35 @@ discard block |
||
38 | 38 | } |
39 | 39 | |
40 | 40 | |
41 | - protected function _get_admin_content_events_edit_for_messenger( EE_messenger $messenger ) { |
|
41 | + protected function _get_admin_content_events_edit_for_messenger(EE_messenger $messenger) { |
|
42 | 42 | //this is just a test |
43 | - return $this->name . ' Message Type for ' . $messenger->name . ' Messenger '; |
|
43 | + return $this->name.' Message Type for '.$messenger->name.' Messenger '; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | |
47 | 47 | |
48 | 48 | |
49 | 49 | protected function _set_data_handler() { |
50 | - if ( is_array( $this->_data ) ) { |
|
51 | - $data_type = reset( $this->_data ); |
|
50 | + if (is_array($this->_data)) { |
|
51 | + $data_type = reset($this->_data); |
|
52 | 52 | |
53 | - if ( is_array( $data_type ) ) { |
|
53 | + if (is_array($data_type)) { |
|
54 | 54 | //grab the first item and see if its a registration. |
55 | - $maybe_reg = isset( $data_type[0] ) && is_array( $data_type[0] ) ? reset( $data_type[0] ) : reset( $data_type ); |
|
56 | - if ( $maybe_reg instanceof EE_Registration ) { |
|
55 | + $maybe_reg = isset($data_type[0]) && is_array($data_type[0]) ? reset($data_type[0]) : reset($data_type); |
|
56 | + if ($maybe_reg instanceof EE_Registration) { |
|
57 | 57 | //is $data_type itself just an array of registrations? |
58 | - if ( isset( $data_type[1] ) && $data_type[1] instanceof EE_Registration ) { |
|
58 | + if (isset($data_type[1]) && $data_type[1] instanceof EE_Registration) { |
|
59 | 59 | $regs = $data_type; |
60 | 60 | } else { |
61 | - $regs = is_array( $data_type[0] ) ? $data_type[0] : array( $maybe_reg ); |
|
61 | + $regs = is_array($data_type[0]) ? $data_type[0] : array($maybe_reg); |
|
62 | 62 | } |
63 | 63 | |
64 | - foreach ( $regs as $reg ) { |
|
65 | - if ( $reg instanceof EE_Registration ) { |
|
64 | + foreach ($regs as $reg) { |
|
65 | + if ($reg instanceof EE_Registration) { |
|
66 | 66 | $this->_regs_for_sending[] = $reg->ID(); |
67 | 67 | } |
68 | 68 | } |
69 | - $this->_data = isset( $this->_data[1] ) ? array( $maybe_reg->transaction(), null, $this->_data[1] ) : array( $maybe_reg->transaction() ); |
|
69 | + $this->_data = isset($this->_data[1]) ? array($maybe_reg->transaction(), null, $this->_data[1]) : array($maybe_reg->transaction()); |
|
70 | 70 | $this->_data_handler = 'Gateways'; |
71 | 71 | } else { |
72 | 72 | $this->_data_handler = 'Gateways'; |
@@ -83,18 +83,18 @@ discard block |
||
83 | 83 | |
84 | 84 | |
85 | 85 | |
86 | - protected function _get_data_for_context( $context, EE_Registration $registration, $id ) { |
|
87 | - if ( $context == 'admin' ) { |
|
86 | + protected function _get_data_for_context($context, EE_Registration $registration, $id) { |
|
87 | + if ($context == 'admin') { |
|
88 | 88 | //use the registration to get the transaction. |
89 | 89 | $transaction = $registration->transaction(); |
90 | 90 | |
91 | 91 | //bail early if no transaction |
92 | - if ( ! $transaction instanceof EE_Transaction ) { |
|
93 | - throw new EE_Error( __('The given registration does not have an associated transaction. Something is wrong.', 'event_espresso' ) ); |
|
92 | + if ( ! $transaction instanceof EE_Transaction) { |
|
93 | + throw new EE_Error(__('The given registration does not have an associated transaction. Something is wrong.', 'event_espresso')); |
|
94 | 94 | } |
95 | 95 | |
96 | - $payment = !empty( $id ) ? EEM_Payment::instance()->get_one( array( array( 'PAY_ID' => $id, 'TXN_ID' => $transaction->ID() ) ) ) : 0; |
|
97 | - return array( $transaction, $payment ); |
|
96 | + $payment = ! empty($id) ? EEM_Payment::instance()->get_one(array(array('PAY_ID' => $id, 'TXN_ID' => $transaction->ID()))) : 0; |
|
97 | + return array($transaction, $payment); |
|
98 | 98 | } else { |
99 | 99 | return $registration; |
100 | 100 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * @return array array of EE_Messages_Addressee objects |
121 | 121 | */ |
122 | 122 | protected function _admin_addressees() { |
123 | - if ( $this->_single_message ) |
|
123 | + if ($this->_single_message) |
|
124 | 124 | return array(); |
125 | 125 | return parent::_admin_addressees(); |
126 | 126 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | |
129 | 129 | |
130 | 130 | protected function _primary_attendee_addressees() { |
131 | - if ( $this->_single_message ) |
|
131 | + if ($this->_single_message) |
|
132 | 132 | return array(); |
133 | 133 | |
134 | 134 | return parent::_primary_attendee_addressees(); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -29,8 +29,8 @@ discard block |
||
29 | 29 | * For the constructor of this special preview class. We're either looking for an event id or empty data. If we have an event id (or ids) then we'll use that as the source for the "dummy" data. If the data is empty then we'll get the first three published events from the users database and use that as a source. |
30 | 30 | * @param array $data |
31 | 31 | */ |
32 | - public function __construct( $data = array() ) { |
|
33 | - $this->_data = isset( $data['event_ids'] ) ? $data['event_ids'] : array(); |
|
32 | + public function __construct($data = array()) { |
|
33 | + $this->_data = isset($data['event_ids']) ? $data['event_ids'] : array(); |
|
34 | 34 | $this->_setup_attendees_events(); |
35 | 35 | parent::__construct($data); |
36 | 36 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @return array The prepped data for db |
48 | 48 | */ |
49 | - static public function convert_data_for_persistent_storage( $data ) { |
|
49 | + static public function convert_data_for_persistent_storage($data) { |
|
50 | 50 | return $data; |
51 | 51 | } |
52 | 52 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return array |
63 | 63 | */ |
64 | - static public function convert_data_from_persistent_storage( $data ) { |
|
64 | + static public function convert_data_from_persistent_storage($data) { |
|
65 | 65 | return $data; |
66 | 66 | } |
67 | 67 | |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | $attendees = $this->_get_some_attendees(); |
79 | 79 | |
80 | 80 | //if empty $data we'll do a query to get some events from the server. otherwise we'll retrieve the event data for the given ids. |
81 | - $events = $this->_get_some_events( $this->_data ); |
|
81 | + $events = $this->_get_some_events($this->_data); |
|
82 | 82 | |
83 | 83 | $answers_n_questions = $this->_get_some_q_and_as(); |
84 | 84 | |
85 | - if ( count( $events ) < 1 ) { |
|
86 | - throw new EE_Error( __('We can\'t generate a preview for you because there are no active events in your database', 'event_espresso' ) ); |
|
85 | + if (count($events) < 1) { |
|
86 | + throw new EE_Error(__('We can\'t generate a preview for you because there are no active events in your database', 'event_espresso')); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | |
94 | 94 | //we'll actually use the generated line_item identifiers for our loop |
95 | 95 | $dtts = $tkts = array(); |
96 | - foreach( $events as $id => $event ) { |
|
97 | - if ( ! $event instanceof EE_Event ) { |
|
96 | + foreach ($events as $id => $event) { |
|
97 | + if ( ! $event instanceof EE_Event) { |
|
98 | 98 | continue; |
99 | 99 | } |
100 | 100 | $this->_events[$id]['ID'] = $id; |
101 | 101 | $this->_events[$id]['name'] = $event->get('EVT_name'); |
102 | 102 | $datetime = $event->get_first_related('Datetime'); |
103 | - $tickets = $datetime instanceof EE_Datetime ? $datetime->get_many_related('Ticket', array('default_where_conditions' => 'none') ) : array(); |
|
103 | + $tickets = $datetime instanceof EE_Datetime ? $datetime->get_many_related('Ticket', array('default_where_conditions' => 'none')) : array(); |
|
104 | 104 | $this->_events[$id]['event'] = $event; |
105 | 105 | $this->_events[$id]['reg_objs'] = array(); |
106 | 106 | $this->_events[$id]['tkt_objs'] = $tickets; |
@@ -108,51 +108,51 @@ discard block |
||
108 | 108 | |
109 | 109 | $dttcache = array(); |
110 | 110 | $tkts = array(); |
111 | - foreach ( $tickets as $ticket ) { |
|
112 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
111 | + foreach ($tickets as $ticket) { |
|
112 | + if ( ! $ticket instanceof EE_Ticket) { |
|
113 | 113 | continue; |
114 | 114 | } |
115 | 115 | $reldatetime = $ticket->datetimes(); |
116 | - $tkts[ $ticket->ID() ] = array(); |
|
117 | - $tkts[ $ticket->ID() ][ 'ticket' ] = $ticket; |
|
118 | - $tkts[ $ticket->ID() ][ 'dtt_objs' ] = $reldatetime; |
|
119 | - $tkts[ $ticket->ID() ][ 'att_objs' ] = $attendees; |
|
120 | - $tkts[ $ticket->ID() ][ 'count' ] = count( $attendees ); |
|
121 | - $tkts[ $ticket->ID() ][ 'EE_Event' ] = $event; |
|
122 | - foreach ( $reldatetime as $datetime ) { |
|
123 | - if ( $datetime instanceof EE_Datetime && ! isset( $dtts[ $datetime->ID() ] ) ) { |
|
124 | - $this->_events[ $id ][ 'dtt_objs' ][ $datetime->ID() ] = $datetime; |
|
125 | - $dtts[ $datetime->ID() ][ 'datetime' ] = $datetime; |
|
126 | - $dtts[ $datetime->ID() ][ 'tkt_objs' ][] = $ticket; |
|
127 | - $dtts[ $datetime->ID() ][ 'evt_objs' ][] = $event; |
|
128 | - $dttcache[ $datetime->ID() ] = $datetime; |
|
116 | + $tkts[$ticket->ID()] = array(); |
|
117 | + $tkts[$ticket->ID()]['ticket'] = $ticket; |
|
118 | + $tkts[$ticket->ID()]['dtt_objs'] = $reldatetime; |
|
119 | + $tkts[$ticket->ID()]['att_objs'] = $attendees; |
|
120 | + $tkts[$ticket->ID()]['count'] = count($attendees); |
|
121 | + $tkts[$ticket->ID()]['EE_Event'] = $event; |
|
122 | + foreach ($reldatetime as $datetime) { |
|
123 | + if ($datetime instanceof EE_Datetime && ! isset($dtts[$datetime->ID()])) { |
|
124 | + $this->_events[$id]['dtt_objs'][$datetime->ID()] = $datetime; |
|
125 | + $dtts[$datetime->ID()]['datetime'] = $datetime; |
|
126 | + $dtts[$datetime->ID()]['tkt_objs'][] = $ticket; |
|
127 | + $dtts[$datetime->ID()]['evt_objs'][] = $event; |
|
128 | + $dttcache[$datetime->ID()] = $datetime; |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
133 | - $this->_events[$id]['total_attendees'] = count( $attendees ); |
|
133 | + $this->_events[$id]['total_attendees'] = count($attendees); |
|
134 | 134 | $this->_events[$id]['att_objs'] = $attendees; |
135 | 135 | |
136 | 136 | //let's also setup the dummy attendees property! |
137 | - foreach ( $attendees as $att_key => $attendee ) { |
|
138 | - if ( ! $attendee instanceof EE_Attendee ) { |
|
137 | + foreach ($attendees as $att_key => $attendee) { |
|
138 | + if ( ! $attendee instanceof EE_Attendee) { |
|
139 | 139 | continue; |
140 | 140 | } |
141 | - $this->_attendees[$att_key]['line_ref'][] = $id; //so later it can be determined what events this attendee registered for! |
|
141 | + $this->_attendees[$att_key]['line_ref'][] = $id; //so later it can be determined what events this attendee registered for! |
|
142 | 142 | $this->_attendees[$att_key]['evt_objs'][] = $event; |
143 | 143 | $this->_attendees[$att_key]['att_obj'] = $attendee; |
144 | 144 | //$this->_attendees[$att_key]['registration_id'] = 0; |
145 | 145 | $this->_attendees[$att_key]['attendee_email'] = $attendee->email(); |
146 | 146 | $this->_attendees[$att_key]['tkt_objs'] = $tickets; |
147 | - if ( $att_key == 999999991 ) { |
|
147 | + if ($att_key == 999999991) { |
|
148 | 148 | $this->_attendees[$att_key]['ans_objs'][999] = $answers_n_questions['answers'][999]; |
149 | 149 | $this->_attendees[$att_key]['ans_objs'][1002] = $answers_n_questions['answers'][1002]; |
150 | 150 | $this->_attendees[$att_key]['ans_objs'][1005] = $answers_n_questions['answers'][1005]; |
151 | - } elseif ( $att_key == 999999992 ) { |
|
151 | + } elseif ($att_key == 999999992) { |
|
152 | 152 | $this->_attendees[$att_key]['ans_objs'][1000] = $answers_n_questions['answers'][1000]; |
153 | 153 | $this->_attendees[$att_key]['ans_objs'][1003] = $answers_n_questions['answers'][1003]; |
154 | 154 | $this->_attendees[$att_key]['ans_objs'][1006] = $answers_n_questions['answers'][1006]; |
155 | - } elseif ( $att_key == 999999993 ) { |
|
155 | + } elseif ($att_key == 999999993) { |
|
156 | 156 | $this->_attendees[$att_key]['ans_objs'][1001] = $answers_n_questions['answers'][1001]; |
157 | 157 | $this->_attendees[$att_key]['ans_objs'][1004] = $answers_n_questions['answers'][1004]; |
158 | 158 | $this->_attendees[$att_key]['ans_objs'][1007] = $answers_n_questions['answers'][1007]; |
@@ -225,11 +225,11 @@ discard block |
||
225 | 225 | |
226 | 226 | //let's generate the attendee objects |
227 | 227 | $attendees = array(); |
228 | - $var_array = array('fname','lname','email','address','address2','city','staid','cntry','zip','phone','deleted','attid'); |
|
228 | + $var_array = array('fname', 'lname', 'email', 'address', 'address2', 'city', 'staid', 'cntry', 'zip', 'phone', 'deleted', 'attid'); |
|
229 | 229 | |
230 | 230 | //EE_Registry::instance()->load_class( 'Attendee', array(), FALSE, false, TRUE ); |
231 | - foreach ( $dummy_attendees as $dummy ) { |
|
232 | - $att = array_combine( $var_array, $dummy ); |
|
231 | + foreach ($dummy_attendees as $dummy) { |
|
232 | + $att = array_combine($var_array, $dummy); |
|
233 | 233 | extract($att); |
234 | 234 | /** @var $fname string */ |
235 | 235 | /** @var $lname string */ |
@@ -346,15 +346,15 @@ discard block |
||
346 | 346 | |
347 | 347 | $qsts = array(); |
348 | 348 | //first the questions |
349 | - foreach ( $quests_array as $qst ) { |
|
350 | - $qstobj = array_combine( $qst_columns, $qst ); |
|
349 | + foreach ($quests_array as $qst) { |
|
350 | + $qstobj = array_combine($qst_columns, $qst); |
|
351 | 351 | $qsts[$qstobj['QST_ID']] = EE_Question::new_instance($qstobj); |
352 | 352 | } |
353 | 353 | |
354 | 354 | //now the answers (and we'll setup our arrays) |
355 | 355 | $q_n_as = array(); |
356 | - foreach ( $ans_array as $ans ) { |
|
357 | - $ansobj = array_combine( $ans_columns, $ans ); |
|
356 | + foreach ($ans_array as $ans) { |
|
357 | + $ansobj = array_combine($ans_columns, $ans); |
|
358 | 358 | $ansobj = EE_Answer::new_instance($ansobj); |
359 | 359 | $q_n_as['answers'][$ansobj->ID()] = $ansobj; |
360 | 360 | $q_n_as['questions'][$ansobj->ID()] = $qsts[$ansobj->get('QST_ID')]; |
@@ -376,25 +376,25 @@ discard block |
||
376 | 376 | * @param array $event_ids if set, this will be an array of event ids to obtain events for. |
377 | 377 | * @return array An array of event objects from the db. |
378 | 378 | */ |
379 | - private function _get_some_events( $event_ids = array() ) { |
|
379 | + private function _get_some_events($event_ids = array()) { |
|
380 | 380 | |
381 | 381 | //HEY, if we have an evt_id then we want to make sure we use that for the preview (because a specific event template is being viewed); |
382 | - $event_ids = isset( $_REQUEST['evt_id'] ) && !empty( $_REQUEST['evt_id'] ) |
|
383 | - ? array( $_REQUEST['evt_id'] ) |
|
382 | + $event_ids = isset($_REQUEST['evt_id']) && ! empty($_REQUEST['evt_id']) |
|
383 | + ? array($_REQUEST['evt_id']) |
|
384 | 384 | : $event_ids; |
385 | 385 | |
386 | - $limit = !empty( $event_ids ) |
|
386 | + $limit = ! empty($event_ids) |
|
387 | 387 | ? NULL |
388 | - : apply_filters( 'FHEE__EE_Messages_Preview_incoming_data___get_some_events__limit', '0,1' ); |
|
388 | + : apply_filters('FHEE__EE_Messages_Preview_incoming_data___get_some_events__limit', '0,1'); |
|
389 | 389 | |
390 | - $where = ! empty( $event_ids ) |
|
390 | + $where = ! empty($event_ids) |
|
391 | 391 | ? array( |
392 | - 'EVT_ID' => array( 'IN', $event_ids ), |
|
393 | - 'Datetime.Ticket.TKT_ID' => array( '>', 1 ) |
|
392 | + 'EVT_ID' => array('IN', $event_ids), |
|
393 | + 'Datetime.Ticket.TKT_ID' => array('>', 1) |
|
394 | 394 | ) |
395 | - : array( 'Datetime.Ticket.TKT_ID' => array( '>', 1 ) ); |
|
395 | + : array('Datetime.Ticket.TKT_ID' => array('>', 1)); |
|
396 | 396 | |
397 | - $events = EE_Registry::instance()->load_model('Event')->get_all(array($where, 'limit' => $limit ) ); |
|
397 | + $events = EE_Registry::instance()->load_model('Event')->get_all(array($where, 'limit' => $limit)); |
|
398 | 398 | |
399 | 399 | return $events; |
400 | 400 | } |
@@ -407,17 +407,17 @@ discard block |
||
407 | 407 | protected function _setup_data() { |
408 | 408 | |
409 | 409 | //need to figure out the running total for test purposes so... we're going to create a temp cart and add the tickets to it! |
410 | - if ( EE_Registry::instance()->SSN instanceof EE_Session ) { |
|
411 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
410 | + if (EE_Registry::instance()->SSN instanceof EE_Session) { |
|
411 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
412 | 412 | $session = EE_Registry::instance()->SSN; |
413 | 413 | } else { |
414 | - $session = EE_Registry::instance()->load_core( 'Session' ); |
|
414 | + $session = EE_Registry::instance()->load_core('Session'); |
|
415 | 415 | } |
416 | - $cart = EE_Cart::instance( null, $session ); |
|
416 | + $cart = EE_Cart::instance(null, $session); |
|
417 | 417 | |
418 | 418 | |
419 | 419 | //add tickets to cart |
420 | - foreach ( $this->tickets as $ticket ) { |
|
420 | + foreach ($this->tickets as $ticket) { |
|
421 | 421 | $cart->add_ticket_to_cart($ticket['ticket']); |
422 | 422 | } |
423 | 423 | |
@@ -441,14 +441,14 @@ discard block |
||
441 | 441 | //note we're setting up a reg object for each attendee in each event but ALSO adding to the reg_object array. |
442 | 442 | $this->reg_objs = array(); |
443 | 443 | $regid = 9999990; |
444 | - foreach ( $this->_attendees as $key => $attendee ) { |
|
444 | + foreach ($this->_attendees as $key => $attendee) { |
|
445 | 445 | //note we need to setup reg_objects for each event this attendee belongs to |
446 | 446 | $regatt = $attendee['att_obj'] instanceof EE_Attendee ? $attendee['att_obj']->ID() : null; |
447 | 447 | $regtxn = $this->txn->ID(); |
448 | 448 | $regcnt = 1; |
449 | - foreach ( $attendee['line_ref'] as $evtid ) { |
|
450 | - foreach ( $this->_events[$evtid]['tkt_objs'] as $ticket ) { |
|
451 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
449 | + foreach ($attendee['line_ref'] as $evtid) { |
|
450 | + foreach ($this->_events[$evtid]['tkt_objs'] as $ticket) { |
|
451 | + if ( ! $ticket instanceof EE_Ticket) { |
|
452 | 452 | continue; |
453 | 453 | } |
454 | 454 | $reg_array = array( |
@@ -460,14 +460,14 @@ discard block |
||
460 | 460 | 'REG_date' => time(), |
461 | 461 | 'REG_final_price' => $ticket->get('TKT_price'), |
462 | 462 | 'REG_session' => 'dummy_session_id', |
463 | - 'REG_code' => $regid . '-dummy-generated-code', |
|
464 | - 'REG_url_link' => $regcnt . '-daafpapasdlfakasdfpqasdfasdf', |
|
463 | + 'REG_code' => $regid.'-dummy-generated-code', |
|
464 | + 'REG_url_link' => $regcnt.'-daafpapasdlfakasdfpqasdfasdf', |
|
465 | 465 | 'REG_count' => $regcnt, |
466 | 466 | 'REG_group_size' => $this->_events[$evtid]['total_attendees'], |
467 | 467 | 'REG_att_is_going' => TRUE, |
468 | 468 | 'REG_ID' => $regid |
469 | 469 | ); |
470 | - $REG_OBJ = EE_Registration::new_instance( $reg_array ); |
|
470 | + $REG_OBJ = EE_Registration::new_instance($reg_array); |
|
471 | 471 | $this->_attendees[$key]['reg_objs'][$regid] = $REG_OBJ; |
472 | 472 | $this->_events[$evtid]['reg_objs'][] = $REG_OBJ; |
473 | 473 | $this->reg_objs[] = $REG_OBJ; |
@@ -483,40 +483,40 @@ discard block |
||
483 | 483 | |
484 | 484 | //setup line items! |
485 | 485 | EE_Registry::instance()->load_helper('Line_Item'); |
486 | - $line_item_total = EEH_Line_Item::create_total_line_item( $this->txn ); |
|
486 | + $line_item_total = EEH_Line_Item::create_total_line_item($this->txn); |
|
487 | 487 | |
488 | 488 | //add tickets |
489 | - foreach ( $this->tickets as $tktid => $item ) { |
|
489 | + foreach ($this->tickets as $tktid => $item) { |
|
490 | 490 | $qty = $item['count']; |
491 | 491 | $ticket = $item['ticket']; |
492 | - EEH_Line_Item::add_ticket_purchase( $line_item_total, $ticket, $qty ); |
|
492 | + EEH_Line_Item::add_ticket_purchase($line_item_total, $ticket, $qty); |
|
493 | 493 | } |
494 | 494 | |
495 | - $shipping_line_item = EE_Line_Item::new_instance( array( |
|
496 | - 'LIN_name' => __( 'Shipping Surcharge', 'event_espresso' ), |
|
497 | - 'LIN_desc' => __( 'Sent via Millenium Falcon', 'event_espresso' ), |
|
495 | + $shipping_line_item = EE_Line_Item::new_instance(array( |
|
496 | + 'LIN_name' => __('Shipping Surcharge', 'event_espresso'), |
|
497 | + 'LIN_desc' => __('Sent via Millenium Falcon', 'event_espresso'), |
|
498 | 498 | 'LIN_unit_price' => 20, |
499 | 499 | 'LIN_quantity' => 1, |
500 | 500 | 'LIN_is_taxable' => TRUE, |
501 | 501 | 'LIN_total' => 20, |
502 | 502 | 'LIN_type' => EEM_Line_Item::type_line_item |
503 | 503 | )); |
504 | - EEH_Line_Item::add_item($line_item_total, $shipping_line_item ); |
|
505 | - $this->additional_line_items = array( $shipping_line_item ); |
|
504 | + EEH_Line_Item::add_item($line_item_total, $shipping_line_item); |
|
505 | + $this->additional_line_items = array($shipping_line_item); |
|
506 | 506 | |
507 | 507 | //now let's add taxes |
508 | - EEH_Line_Item::apply_taxes( $line_item_total ); |
|
508 | + EEH_Line_Item::apply_taxes($line_item_total); |
|
509 | 509 | |
510 | 510 | //now we should be able to get the items we need from this object |
511 | - $event_line_items = EEH_Line_Item::get_pre_tax_subtotal( $line_item_total )->children(); |
|
511 | + $event_line_items = EEH_Line_Item::get_pre_tax_subtotal($line_item_total)->children(); |
|
512 | 512 | $line_items = array(); |
513 | - foreach ( $event_line_items as $line_id => $line_item ) { |
|
514 | - if ( ! $line_item instanceof EE_Line_Item || $line_item->OBJ_type() !== 'Event' ) { |
|
513 | + foreach ($event_line_items as $line_id => $line_item) { |
|
514 | + if ( ! $line_item instanceof EE_Line_Item || $line_item->OBJ_type() !== 'Event') { |
|
515 | 515 | continue; |
516 | 516 | } |
517 | - $ticket_line_items = EEH_Line_Item::get_ticket_line_items( $line_item ); |
|
518 | - foreach ( $ticket_line_items as $ticket_line_id => $ticket_line_item ) { |
|
519 | - if ( ! $ticket_line_item instanceof EE_Line_Item ) { |
|
517 | + $ticket_line_items = EEH_Line_Item::get_ticket_line_items($line_item); |
|
518 | + foreach ($ticket_line_items as $ticket_line_id => $ticket_line_item) { |
|
519 | + if ( ! $ticket_line_item instanceof EE_Line_Item) { |
|
520 | 520 | continue; |
521 | 521 | } |
522 | 522 | $this->tickets[$ticket_line_item->OBJ_ID()]['line_item'] = $ticket_line_item; |
@@ -532,12 +532,12 @@ discard block |
||
532 | 532 | //add proper total to transaction object. |
533 | 533 | $grand_total = $line_item_total->recalculate_total_including_taxes(); |
534 | 534 | $this->grand_total_line_item = $line_item_total; |
535 | - $this->txn->set_total( $grand_total ); |
|
535 | + $this->txn->set_total($grand_total); |
|
536 | 536 | |
537 | 537 | |
538 | 538 | //add additional details for each registration |
539 | - foreach ( $this->reg_objs as $reg ) { |
|
540 | - if ( ! $reg instanceof EE_Registration ) { |
|
539 | + foreach ($this->reg_objs as $reg) { |
|
540 | + if ( ! $reg instanceof EE_Registration) { |
|
541 | 541 | continue; |
542 | 542 | } |
543 | 543 | $this->_registrations[$reg->ID()]['tkt_obj'] = $this->tickets[$reg->get('TKT_ID')]['ticket']; |
@@ -562,17 +562,17 @@ discard block |
||
562 | 562 | ? $this->_attendees[999999991]['att_obj']->fname() |
563 | 563 | : '', |
564 | 564 | |
565 | - 'lname' => $this->_attendees[ 999999991 ][ 'att_obj' ] instanceof EE_Attendee |
|
565 | + 'lname' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee |
|
566 | 566 | ? $this->_attendees[999999991]['att_obj']->lname() |
567 | 567 | : '', |
568 | 568 | |
569 | - 'email' => $this->_attendees[ 999999991 ][ 'att_obj' ] instanceof EE_Attendee |
|
569 | + 'email' => $this->_attendees[999999991]['att_obj'] instanceof EE_Attendee |
|
570 | 570 | ? $this->_attendees[999999991]['att_obj']->email() |
571 | 571 | : '', |
572 | 572 | |
573 | 573 | 'att_obj' => $this->_attendees[999999991]['att_obj'], |
574 | 574 | |
575 | - 'reg_obj' => array_shift( $attendees_to_shift[999999991]['reg_objs'] ) |
|
575 | + 'reg_obj' => array_shift($attendees_to_shift[999999991]['reg_objs']) |
|
576 | 576 | ); |
577 | 577 | |
578 | 578 | //reg_info property |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | $this->reg_info = array(); |
581 | 581 | |
582 | 582 | //let's set a reg_obj for messengers expecting one. |
583 | - $this->reg_obj = array_pop( $this->_attendees[999999991]['reg_objs'] ); |
|
583 | + $this->reg_obj = array_pop($this->_attendees[999999991]['reg_objs']); |
|
584 | 584 | |
585 | 585 | |
586 | 586 | //the below are just dummy items. |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -29,20 +29,20 @@ discard block |
||
29 | 29 | * @param EE_Registration|array $data |
30 | 30 | * @throws \EE_Error |
31 | 31 | */ |
32 | - public function __construct( $data ) { |
|
32 | + public function __construct($data) { |
|
33 | 33 | $filtered_reg_status = null; |
34 | 34 | |
35 | - if ( ! is_array( $data ) && $data instanceof EE_Registration ) { |
|
35 | + if ( ! is_array($data) && $data instanceof EE_Registration) { |
|
36 | 36 | $this->reg_obj = $data; |
37 | 37 | } else { |
38 | - $this->reg_obj = is_array( $data ) && isset( $data[0] ) && $data[0] instanceof EE_Registration ? $data[0] : null; |
|
39 | - $filtered_reg_status = is_array( $data ) && ! empty( $data[1] ) ? $data[1] : null; |
|
38 | + $this->reg_obj = is_array($data) && isset($data[0]) && $data[0] instanceof EE_Registration ? $data[0] : null; |
|
39 | + $filtered_reg_status = is_array($data) && ! empty($data[1]) ? $data[1] : null; |
|
40 | 40 | } |
41 | 41 | |
42 | - if ( ! $this->reg_obj instanceof EE_Registration ) { |
|
42 | + if ( ! $this->reg_obj instanceof EE_Registration) { |
|
43 | 43 | throw new EE_Error( |
44 | 44 | sprintf( |
45 | - __( '%1$s requires the incoming data argument to be an instance of %2$s or an array where the first value is an instance of %2$s', 'event_espresso'), |
|
45 | + __('%1$s requires the incoming data argument to be an instance of %2$s or an array where the first value is an instance of %2$s', 'event_espresso'), |
|
46 | 46 | 'EE_Messages_REG_incoming_data', |
47 | 47 | 'EE_Registration' |
48 | 48 | ) |
@@ -64,18 +64,18 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return array The prepped data for db |
66 | 66 | */ |
67 | - static public function convert_data_for_persistent_storage( $data ) { |
|
67 | + static public function convert_data_for_persistent_storage($data) { |
|
68 | 68 | $prepped_data = array(); |
69 | - if ( ! is_array( $data ) && $data instanceof EE_Registration ) { |
|
69 | + if ( ! is_array($data) && $data instanceof EE_Registration) { |
|
70 | 70 | $prepped_data['Registration'] = $data->ID(); |
71 | 71 | return $prepped_data; |
72 | - } elseif ( ! is_array( $data ) ) { |
|
72 | + } elseif ( ! is_array($data)) { |
|
73 | 73 | return array(); |
74 | 74 | } else { |
75 | - if ( $data[0] instanceof EE_Registration ) { |
|
75 | + if ($data[0] instanceof EE_Registration) { |
|
76 | 76 | $prepped_data['Registration'] = $data[0]; |
77 | 77 | } |
78 | - if ( ! empty( $data[1] ) ) { |
|
78 | + if ( ! empty($data[1])) { |
|
79 | 79 | $prepped_data['filter'] = $data[1]; |
80 | 80 | } |
81 | 81 | } |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return mixed |
93 | 93 | */ |
94 | - static public function convert_data_from_persistent_storage( $data ) { |
|
94 | + static public function convert_data_from_persistent_storage($data) { |
|
95 | 95 | $registration = null; |
96 | 96 | //$data['Registration'] could be either an ID (back compat) or a registration object (prepped using old system). |
97 | - if ( isset( $data[ 'Registration' ] ) ) { |
|
98 | - $registration = $data[ 'Registration' ] instanceof EE_Registration |
|
99 | - ? $data[ 'Registration' ] |
|
100 | - : EEM_Registration::instance()->get_one_by_ID( $data[ 'Registration' ] ); |
|
97 | + if (isset($data['Registration'])) { |
|
98 | + $registration = $data['Registration'] instanceof EE_Registration |
|
99 | + ? $data['Registration'] |
|
100 | + : EEM_Registration::instance()->get_one_by_ID($data['Registration']); |
|
101 | 101 | } |
102 | 102 | $prepped_data = array( |
103 | 103 | 0 => $registration, |
104 | - 1 => isset( $data['filter'] ) ? $data['filter'] : null |
|
104 | + 1 => isset($data['filter']) ? $data['filter'] : null |
|
105 | 105 | ); |
106 | 106 | return $prepped_data; |
107 | 107 | } |
@@ -119,18 +119,18 @@ discard block |
||
119 | 119 | $this->txn = $this->reg_obj->transaction(); |
120 | 120 | //possible session stuff? |
121 | 121 | $session = $this->txn->session_data(); |
122 | - $session_data = $session instanceof EE_Session ? $session->get_session_data() : array(); |
|
122 | + $session_data = $session instanceof EE_Session ? $session->get_session_data() : array(); |
|
123 | 123 | |
124 | 124 | //other data from the session (if possible) |
125 | - $this->user_id = isset( $session_data['user_id'] ) ? $session_data['user_id'] : ''; |
|
126 | - $this->ip_address = isset( $session_data['ip_address'] ) ? $session_data['ip_address'] : ''; |
|
127 | - $this->user_agent = isset( $session_data['user_agent'] ) ? $session_data['user_agent'] : ''; |
|
125 | + $this->user_id = isset($session_data['user_id']) ? $session_data['user_id'] : ''; |
|
126 | + $this->ip_address = isset($session_data['ip_address']) ? $session_data['ip_address'] : ''; |
|
127 | + $this->user_agent = isset($session_data['user_agent']) ? $session_data['user_agent'] : ''; |
|
128 | 128 | $this->init_access = $this->last_access = ''; |
129 | 129 | |
130 | 130 | $this->payment = $this->txn->get_first_related('Payment'); |
131 | 131 | // if there is no payments associated with the transaction |
132 | 132 | // then we just create a default payment object for potential parsing. |
133 | - $this->payment = empty( $this->payment ) |
|
133 | + $this->payment = empty($this->payment) |
|
134 | 134 | ? EE_Payment::new_instance( |
135 | 135 | array( |
136 | 136 | 'STS_ID' => EEM_Payment::status_id_pending, |
@@ -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 | /** |
@@ -109,14 +109,14 @@ discard block |
||
109 | 109 | * about where to obtain the templates. |
110 | 110 | * |
111 | 111 | */ |
112 | - final private function _set_templates( $template_pack ) { |
|
112 | + final private function _set_templates($template_pack) { |
|
113 | 113 | |
114 | 114 | //get the corresponding template pack object (if present. If not then we just load the default and add a |
115 | 115 | //notice). The class name should be something like 'EE_Messages_Template_Pack_Default' where "default' would be |
116 | 116 | //the incoming template pack reference. |
117 | - $class_name = 'EE_Messages_Template_Pack_' . str_replace( ' ', '_', ucwords( str_replace( '_', ' ', $template_pack ) ) ); |
|
117 | + $class_name = 'EE_Messages_Template_Pack_'.str_replace(' ', '_', ucwords(str_replace('_', ' ', $template_pack))); |
|
118 | 118 | |
119 | - if ( ! class_exists( $class_name ) ) { |
|
119 | + if ( ! class_exists($class_name)) { |
|
120 | 120 | EE_Error::add_error( |
121 | 121 | sprintf( |
122 | 122 | __( |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $template_pack = new $class_name; |
136 | 136 | |
137 | 137 | //get all the templates from the template pack. |
138 | - $this->_templates = $template_pack->get_templates( $this->_messenger, $this->_message_type ); |
|
138 | + $this->_templates = $template_pack->get_templates($this->_messenger, $this->_message_type); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | |
@@ -159,15 +159,15 @@ discard block |
||
159 | 159 | public function create_new_templates() { |
160 | 160 | $template_pack = 'default'; |
161 | 161 | //if we have the GRP_ID then let's use that to see if there is a set template pack and use that for the new templates. |
162 | - if ( ! empty( $this->_GRP_ID ) ) { |
|
163 | - $message_template_group = $this->_message_template_group_model->get_one_by_ID( $this->_GRP_ID ); |
|
162 | + if ( ! empty($this->_GRP_ID)) { |
|
163 | + $message_template_group = $this->_message_template_group_model->get_one_by_ID($this->_GRP_ID); |
|
164 | 164 | $template_pack = $message_template_group instanceof EE_Message_Template_Group |
165 | 165 | ? $message_template_group->get_template_pack_name() |
166 | 166 | : 'default'; |
167 | 167 | //we also need to reset the template variation to default |
168 | - $message_template_group->set_template_pack_variation( 'default' ); |
|
168 | + $message_template_group->set_template_pack_variation('default'); |
|
169 | 169 | } |
170 | - return $this->_create_new_templates( $template_pack ); |
|
170 | + return $this->_create_new_templates($template_pack); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | |
@@ -181,12 +181,12 @@ discard block |
||
181 | 181 | * which will contain information about where to obtain the templates. |
182 | 182 | * @return mixed (array|bool) success array or false. |
183 | 183 | */ |
184 | - protected function _create_new_templates( $template_pack ) { |
|
184 | + protected function _create_new_templates($template_pack) { |
|
185 | 185 | |
186 | - $this->_set_templates( $template_pack ); |
|
186 | + $this->_set_templates($template_pack); |
|
187 | 187 | |
188 | 188 | //necessary properties are set, let's save the default templates |
189 | - if ( empty( $this->_GRP_ID ) ) { |
|
189 | + if (empty($this->_GRP_ID)) { |
|
190 | 190 | $main_template_data = array( |
191 | 191 | 'MTP_messenger' => $this->_messenger->name, |
192 | 192 | 'MTP_message_type' => $this->_message_type->name, |
@@ -197,24 +197,24 @@ discard block |
||
197 | 197 | 'MTP_is_active' => 1, |
198 | 198 | ); |
199 | 199 | //let's insert the above and get our GRP_ID, then reset the template data array to just include the GRP_ID |
200 | - $grp_id = $this->_message_template_group_model->insert( $main_template_data ); |
|
201 | - if ( empty( $grp_id ) ) { |
|
200 | + $grp_id = $this->_message_template_group_model->insert($main_template_data); |
|
201 | + if (empty($grp_id)) { |
|
202 | 202 | return $grp_id; |
203 | 203 | } |
204 | 204 | $this->_GRP_ID = $grp_id; |
205 | 205 | } |
206 | 206 | |
207 | - $template_data = array( 'GRP_ID' => $this->_GRP_ID ); |
|
207 | + $template_data = array('GRP_ID' => $this->_GRP_ID); |
|
208 | 208 | |
209 | - foreach ( $this->_contexts as $context => $details ) { |
|
210 | - foreach ( $this->_fields as $field => $field_type ) { |
|
211 | - if ( $field != 'extra' ) { |
|
209 | + foreach ($this->_contexts as $context => $details) { |
|
210 | + foreach ($this->_fields as $field => $field_type) { |
|
211 | + if ($field != 'extra') { |
|
212 | 212 | $template_data['MTP_context'] = $context; |
213 | 213 | $template_data['MTP_template_field'] = $field; |
214 | - $template_data['MTP_content'] = $this->_templates[ $context ][ $field ]; |
|
214 | + $template_data['MTP_content'] = $this->_templates[$context][$field]; |
|
215 | 215 | |
216 | - $MTP = $this->_message_template_model->insert( $template_data ); |
|
217 | - if ( ! $MTP ) { |
|
216 | + $MTP = $this->_message_template_model->insert($template_data); |
|
217 | + if ( ! $MTP) { |
|
218 | 218 | EE_Error::add_error( |
219 | 219 | sprintf( |
220 | 220 | __( |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | |
239 | 239 | return array( |
240 | 240 | 'GRP_ID' => $this->_GRP_ID, |
241 | - 'MTP_context' => key( $this->_contexts ) |
|
241 | + 'MTP_context' => key($this->_contexts) |
|
242 | 242 | ); |
243 | 243 | } |
244 | 244 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | /** |
30 | 30 | * This sets up the email messenger for the EE_messages (notifications) subsystem in EE. |
31 | 31 | */ |
32 | -class EE_Email_messenger extends EE_messenger { |
|
32 | +class EE_Email_messenger extends EE_messenger { |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * The following are the properties that email requires for the message going out. |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | protected function _set_valid_shortcodes() { |
78 | 78 | //remember by leaving the other fields not set, those fields will inherit the valid shortcodes from the message type. |
79 | 79 | $this->_valid_shortcodes = array( |
80 | - 'to' => array('email','event_author', 'primary_registration_details', 'recipient_details'), |
|
80 | + 'to' => array('email', 'event_author', 'primary_registration_details', 'recipient_details'), |
|
81 | 81 | 'from' => array('email', 'event_author', 'primary_registration_details', 'recipient_details') |
82 | 82 | ); |
83 | 83 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | 'shortcodes' => array('organization', 'primary_registration_details', 'event_author', 'primary_registration_details', 'recipient_details') |
112 | 112 | ), |
113 | 113 | 'content' => array( |
114 | - 'shortcodes' => array('event_list','attendee_list', 'ticket_list', 'organization', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list', 'transaction', 'messenger') |
|
114 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket_list', 'organization', 'primary_registration_details', 'primary_registration_list', 'event_author', 'recipient_details', 'recipient_list', 'transaction', 'messenger') |
|
115 | 115 | ), |
116 | 116 | 'attendee_list' => array( |
117 | 117 | 'shortcodes' => array('attendee', 'event_list', 'ticket_list'), |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | 'required' => array('[EVENT_LIST]') |
123 | 123 | ), |
124 | 124 | 'ticket_list' => array( |
125 | - 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list','primary_registration_details', 'recipient_details'), |
|
125 | + 'shortcodes' => array('event_list', 'attendee_list', 'ticket', 'datetime_list', 'primary_registration_details', 'recipient_details'), |
|
126 | 126 | 'required' => array('[TICKET_LIST]') |
127 | 127 | ), |
128 | 128 | 'datetime_list' => array( |
@@ -141,21 +141,21 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @since 4.5.0 |
143 | 143 | */ |
144 | - public function do_secondary_messenger_hooks( $sending_messenger_name ) { |
|
145 | - if ( $sending_messenger_name = 'html' ) { |
|
146 | - add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( $this, 'add_email_css' ), 10, 8 ); |
|
144 | + public function do_secondary_messenger_hooks($sending_messenger_name) { |
|
145 | + if ($sending_messenger_name = 'html') { |
|
146 | + add_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10, 8); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | 150 | |
151 | 151 | |
152 | 152 | |
153 | - public function add_email_css( $variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack ) { |
|
153 | + public function add_email_css($variation_path, $messenger, $message_type, $type, $variation, $file_extension, $url, EE_Messages_Template_Pack $template_pack) { |
|
154 | 154 | //prevent recursion on this callback. |
155 | - remove_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( $this, 'add_email_css' ), 10 ); |
|
156 | - $variation = $this->get_variation( $template_pack, $message_type, $url, 'main', $variation, FALSE ); |
|
155 | + remove_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10); |
|
156 | + $variation = $this->get_variation($template_pack, $message_type, $url, 'main', $variation, FALSE); |
|
157 | 157 | |
158 | - add_filter( 'FHEE__EE_Messages_Template_Pack__get_variation', array( $this, 'add_email_css' ), 10, 8 ); |
|
158 | + add_filter('FHEE__EE_Messages_Template_Pack__get_variation', array($this, 'add_email_css'), 10, 8); |
|
159 | 159 | return $variation; |
160 | 160 | } |
161 | 161 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | 'required' => FALSE, |
188 | 188 | 'validation' => FALSE, |
189 | 189 | 'format' => '%s', |
190 | - 'value' => sprintf( __('Test email sent from %s', 'event_espresso'), get_bloginfo('name') ), |
|
190 | + 'value' => sprintf(__('Test email sent from %s', 'event_espresso'), get_bloginfo('name')), |
|
191 | 191 | 'default'=> '', |
192 | 192 | 'css_class' => '' |
193 | 193 | ) |
@@ -349,16 +349,16 @@ discard block |
||
349 | 349 | * @return bool | WP_Error true if message delivered, false if it didn't deliver OR bubble up any error object if present. |
350 | 350 | */ |
351 | 351 | protected function _send_message() { |
352 | - $success = wp_mail( |
|
353 | - html_entity_decode( $this->_to, ENT_QUOTES, "UTF-8" ), |
|
354 | - stripslashes( html_entity_decode( $this->_subject, ENT_QUOTES, "UTF-8" )), |
|
352 | + $success = wp_mail( |
|
353 | + html_entity_decode($this->_to, ENT_QUOTES, "UTF-8"), |
|
354 | + stripslashes(html_entity_decode($this->_subject, ENT_QUOTES, "UTF-8")), |
|
355 | 355 | $this->_body(), |
356 | 356 | $this->_headers() |
357 | 357 | ); |
358 | - if ( ! $success ) { |
|
358 | + if ( ! $success) { |
|
359 | 359 | EE_Error::add_error( |
360 | 360 | sprintf( |
361 | - __( 'The email did not send successfully.%3$sThe WordPress wp_mail function is used for sending mails but does not give any useful information when an email fails to send.%3$sIt is possible the "to" address (%1$s) or "from" address (%2$s) is invalid.%3$s', 'event_espresso'), |
|
361 | + __('The email did not send successfully.%3$sThe WordPress wp_mail function is used for sending mails but does not give any useful information when an email fails to send.%3$sIt is possible the "to" address (%1$s) or "from" address (%2$s) is invalid.%3$s', 'event_espresso'), |
|
362 | 362 | $this->_to, |
363 | 363 | $this->_from, |
364 | 364 | '<br />' |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | * @return string html body of the message content and the related css. |
378 | 378 | */ |
379 | 379 | protected function _preview() { |
380 | - return $this->_body( true ); |
|
380 | + return $this->_body(true); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | |
@@ -391,18 +391,18 @@ discard block |
||
391 | 391 | * @return string formatted header for email |
392 | 392 | */ |
393 | 393 | protected function _headers() { |
394 | - $from = stripslashes_deep( html_entity_decode($this->_from, ENT_QUOTES,"UTF-8" ) ); |
|
394 | + $from = stripslashes_deep(html_entity_decode($this->_from, ENT_QUOTES, "UTF-8")); |
|
395 | 395 | $headers = array( |
396 | 396 | 'MIME-Version: 1.0', |
397 | - 'From:' . $from, |
|
398 | - 'Reply-To:' . $from, |
|
397 | + 'From:'.$from, |
|
398 | + 'Reply-To:'.$from, |
|
399 | 399 | 'Content-Type:text/html; charset=utf-8' |
400 | 400 | ); |
401 | 401 | |
402 | 402 | //but wait! Header's for the from is NOT reliable because some plugins don't respect From: as set in the header. |
403 | - add_filter( 'wp_mail_from', array( $this, 'set_from_address' ), 100 ); |
|
404 | - add_filter( 'wp_mail_from_name', array( $this, 'set_from_name' ), 100 ); |
|
405 | - return apply_filters( 'FHEE__EE_Email_messenger___headers', $headers, $this->_incoming_message_type, $this ); |
|
403 | + add_filter('wp_mail_from', array($this, 'set_from_address'), 100); |
|
404 | + add_filter('wp_mail_from_name', array($this, 'set_from_name'), 100); |
|
405 | + return apply_filters('FHEE__EE_Email_messenger___headers', $headers, $this->_incoming_message_type, $this); |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | |
@@ -418,19 +418,19 @@ discard block |
||
418 | 418 | * @return array |
419 | 419 | */ |
420 | 420 | private function _parse_from() { |
421 | - if ( strpos( $this->_from, '<' ) !== false ) { |
|
422 | - $from_name = substr( $this->_from, 0, strpos( $this->_from, '<' ) - 1 ); |
|
423 | - $from_name = str_replace( '"', '', $from_name ); |
|
424 | - $from_name = trim( $from_name ); |
|
425 | - |
|
426 | - $from_email = substr( $this->_from, strpos( $this->_from, '<' ) + 1 ); |
|
427 | - $from_email = str_replace( '>', '', $from_email ); |
|
428 | - $from_email = trim( $from_email ); |
|
421 | + if (strpos($this->_from, '<') !== false) { |
|
422 | + $from_name = substr($this->_from, 0, strpos($this->_from, '<') - 1); |
|
423 | + $from_name = str_replace('"', '', $from_name); |
|
424 | + $from_name = trim($from_name); |
|
425 | + |
|
426 | + $from_email = substr($this->_from, strpos($this->_from, '<') + 1); |
|
427 | + $from_email = str_replace('>', '', $from_email); |
|
428 | + $from_email = trim($from_email); |
|
429 | 429 | } else { |
430 | 430 | $from_name = ''; |
431 | - $from_email = trim( $this->_from ); |
|
431 | + $from_email = trim($this->_from); |
|
432 | 432 | } |
433 | - return array( $from_name, $from_email ); |
|
433 | + return array($from_name, $from_email); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | * |
444 | 444 | * @param string $from_email What the original from_email is. |
445 | 445 | */ |
446 | - public function set_from_address( $from_email ) { |
|
446 | + public function set_from_address($from_email) { |
|
447 | 447 | $parsed_from = $this->_parse_from(); |
448 | 448 | return $parsed_from[1]; |
449 | 449 | } |
@@ -458,13 +458,13 @@ discard block |
||
458 | 458 | * |
459 | 459 | * @param string $from_name The original from_name. |
460 | 460 | */ |
461 | - public function set_from_name( $from_name ) { |
|
461 | + public function set_from_name($from_name) { |
|
462 | 462 | $parsed_from = $this->_parse_from(); |
463 | - if ( is_array( $parsed_from) && ! empty( $parsed_from[0] ) ) { |
|
464 | - $from_name = $parsed_from[0]; |
|
463 | + if (is_array($parsed_from) && ! empty($parsed_from[0])) { |
|
464 | + $from_name = $parsed_from[0]; |
|
465 | 465 | } |
466 | 466 | |
467 | - return stripslashes_deep( html_entity_decode($from_name, ENT_QUOTES,"UTF-8" ) ); |
|
467 | + return stripslashes_deep(html_entity_decode($from_name, ENT_QUOTES, "UTF-8")); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | |
@@ -475,14 +475,14 @@ discard block |
||
475 | 475 | * @param bool $preview will determine whether this is preview template or not. |
476 | 476 | * @return string formatted body for email. |
477 | 477 | */ |
478 | - protected function _body( $preview = false ) { |
|
478 | + protected function _body($preview = false) { |
|
479 | 479 | //setup template args! |
480 | 480 | $this->_template_args = array( |
481 | 481 | 'subject' => $this->_subject, |
482 | 482 | 'from' => $this->_from, |
483 | - 'main_body' => wpautop(stripslashes_deep( html_entity_decode($this->_content, ENT_QUOTES,"UTF-8" ) )) |
|
483 | + 'main_body' => wpautop(stripslashes_deep(html_entity_decode($this->_content, ENT_QUOTES, "UTF-8"))) |
|
484 | 484 | ); |
485 | - $body = $this->_get_main_template( $preview ); |
|
485 | + $body = $this->_get_main_template($preview); |
|
486 | 486 | |
487 | 487 | /** |
488 | 488 | * This filter allows one to bypass the CSSToInlineStyles tool and leave the body untouched. |
@@ -490,17 +490,17 @@ discard block |
||
490 | 490 | * @type bool $preview Indicates whether a preview is being generated or not. |
491 | 491 | * @return bool true indicates to use the inliner, false bypasses it. |
492 | 492 | */ |
493 | - if ( apply_filters( 'FHEE__EE_Email_messenger__apply_CSSInliner ', true, $preview ) ) { |
|
493 | + if (apply_filters('FHEE__EE_Email_messenger__apply_CSSInliner ', true, $preview)) { |
|
494 | 494 | |
495 | 495 | //require CssToInlineStyles library and its dependencies via composer autoloader |
496 | - require_once EE_THIRD_PARTY . 'cssinliner/vendor/autoload.php'; |
|
496 | + require_once EE_THIRD_PARTY.'cssinliner/vendor/autoload.php'; |
|
497 | 497 | |
498 | 498 | //now if this isn't a preview, let's setup the body so it has inline styles |
499 | - if ( ! $preview || ( $preview && defined( 'DOING_AJAX' ) ) ) { |
|
500 | - $style = file_get_contents( $this->get_variation( $this->_tmp_pack, $this->_incoming_message_type->name, FALSE, 'main', $this->_variation ), TRUE ); |
|
501 | - $CSS = new TijsVerkoyen\CssToInlineStyles\CssToInlineStyles( $body, $style ); |
|
502 | - $body = ltrim( $CSS->convert( true ), ">\n" ); //for some reason the library has a bracket and new line at the beginning. This takes care of that. |
|
503 | - $body = ltrim( $body, "<?" ); //see https://events.codebasehq.com/projects/event-espresso/tickets/8609 |
|
499 | + if ( ! $preview || ($preview && defined('DOING_AJAX'))) { |
|
500 | + $style = file_get_contents($this->get_variation($this->_tmp_pack, $this->_incoming_message_type->name, FALSE, 'main', $this->_variation), TRUE); |
|
501 | + $CSS = new TijsVerkoyen\CssToInlineStyles\CssToInlineStyles($body, $style); |
|
502 | + $body = ltrim($CSS->convert(true), ">\n"); //for some reason the library has a bracket and new line at the beginning. This takes care of that. |
|
503 | + $body = ltrim($body, "<?"); //see https://events.codebasehq.com/projects/event-espresso/tickets/8609 |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | } |
@@ -519,8 +519,8 @@ discard block |
||
519 | 519 | public function get_existing_test_settings() { |
520 | 520 | $settings = parent::get_existing_test_settings(); |
521 | 521 | //override subject if present because we always want it to be fresh. |
522 | - if ( is_array( $settings ) && ! empty( $settings['subject'] ) ) { |
|
523 | - $settings['subject'] = sprintf( __('Test email sent from %s', 'event_espresso'), get_bloginfo('name') ); |
|
522 | + if (is_array($settings) && ! empty($settings['subject'])) { |
|
523 | + $settings['subject'] = sprintf(__('Test email sent from %s', 'event_espresso'), get_bloginfo('name')); |
|
524 | 524 | } |
525 | 525 | return $settings; |
526 | 526 | } |
@@ -1,7 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | +} |
|
5 | 6 | |
6 | 7 | /** |
7 | 8 | * Event Espresso |
@@ -197,8 +198,10 @@ discard block |
||
197 | 198 | $sc_to_verify = !empty($matches[0] ) ? $matches[0][0] . ']' : $shortcode; |
198 | 199 | |
199 | 200 | //first we want to make sure this is a valid shortcode |
200 | - if ( !array_key_exists($sc_to_verify, $this->_shortcodes ) ) |
|
201 | - return false; //get out, this parser doesn't handle the incoming shortcode. |
|
201 | + if ( !array_key_exists($sc_to_verify, $this->_shortcodes ) ) { |
|
202 | + return false; |
|
203 | + } |
|
204 | + //get out, this parser doesn't handle the incoming shortcode. |
|
202 | 205 | $this->_data = $data; |
203 | 206 | $this->_extra_data = $extra_data; |
204 | 207 | $this->_set_messages_properties(); |
@@ -276,8 +279,9 @@ discard block |
||
276 | 279 | } |
277 | 280 | |
278 | 281 | //next test to make sure we've got got a data index in the incoming data array |
279 | - if ( !isset( $this->_data['data'] ) ) |
|
280 | - throw new EE_Error( __('The incoming data does not have the required data index in its array', 'event_espresso') ); |
|
282 | + if ( !isset( $this->_data['data'] ) ) { |
|
283 | + throw new EE_Error( __('The incoming data does not have the required data index in its array', 'event_espresso') ); |
|
284 | + } |
|
281 | 285 | |
282 | 286 | //all is well let's make sure _extra_data always has the values needed. |
283 | 287 | //let's make sure that extra_data includes all templates (for later parsing if necessary) |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | |
173 | 173 | public function get_shortcode_helper() { |
174 | - if ( ! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes ) { |
|
174 | + if ( ! $this->_shortcode_helper instanceof EEH_Parse_Shortcodes) { |
|
175 | 175 | $this->_set_shortcode_helper(); |
176 | 176 | } |
177 | 177 | return $this->_shortcode_helper; |
@@ -185,25 +185,25 @@ discard block |
||
185 | 185 | * @param mixed (object|array) $extra_data extra incoming data (usually EE_Messages_Addressee) |
186 | 186 | * @return string parsed shortcode. |
187 | 187 | */ |
188 | - public function parser($shortcode, $data, $extra_data = array() ) { |
|
188 | + public function parser($shortcode, $data, $extra_data = array()) { |
|
189 | 189 | |
190 | 190 | //filter setup shortcodes |
191 | 191 | $this->_shortcodes = $this->get_shortcodes(); |
192 | 192 | |
193 | 193 | //we need to setup any dynamic shortcodes so that they work with the array_key_exists |
194 | - $sc = preg_match_all( '/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches ); |
|
195 | - $sc_to_verify = !empty($matches[0] ) ? $matches[0][0] . ']' : $shortcode; |
|
194 | + $sc = preg_match_all('/(\[[A-Za-z0-9\_]+_\*)/', $shortcode, $matches); |
|
195 | + $sc_to_verify = ! empty($matches[0]) ? $matches[0][0].']' : $shortcode; |
|
196 | 196 | |
197 | 197 | //first we want to make sure this is a valid shortcode |
198 | - if ( !array_key_exists($sc_to_verify, $this->_shortcodes ) ) |
|
198 | + if ( ! array_key_exists($sc_to_verify, $this->_shortcodes)) |
|
199 | 199 | return false; //get out, this parser doesn't handle the incoming shortcode. |
200 | 200 | $this->_data = $data; |
201 | 201 | $this->_extra_data = $extra_data; |
202 | 202 | $this->_set_messages_properties(); |
203 | - $parsed = apply_filters( 'FHEE__' . get_class($this) . '__parser_after', $this->_parser($shortcode), $shortcode, $data, $extra_data, $this ); |
|
203 | + $parsed = apply_filters('FHEE__'.get_class($this).'__parser_after', $this->_parser($shortcode), $shortcode, $data, $extra_data, $this); |
|
204 | 204 | |
205 | 205 | //note the below filter applies to ALL shortcode parsers... be careful! |
206 | - $parsed = apply_filters( 'FHEE__EE_Shortcodes__parser_after', $parsed, $shortcode, $data, $extra_data, $this ); |
|
206 | + $parsed = apply_filters('FHEE__EE_Shortcodes__parser_after', $parsed, $shortcode, $data, $extra_data, $this); |
|
207 | 207 | return $parsed; |
208 | 208 | } |
209 | 209 | |
@@ -219,10 +219,10 @@ discard block |
||
219 | 219 | * @return array array of shortcodes => description pairs |
220 | 220 | */ |
221 | 221 | public function get_shortcodes() { |
222 | - $this->_shortcodes = apply_filters( 'FHEE__' . get_class($this) . '__shortcodes', $this->_shortcodes, $this ); |
|
222 | + $this->_shortcodes = apply_filters('FHEE__'.get_class($this).'__shortcodes', $this->_shortcodes, $this); |
|
223 | 223 | |
224 | 224 | //note the below filter applies to ALL shortcode parsers... be careful! |
225 | - $this->_shortcodes = apply_filters( 'FHEE__EE_Shortcodes__shortcodes', $this->_shortcodes, $this ); |
|
225 | + $this->_shortcodes = apply_filters('FHEE__EE_Shortcodes__shortcodes', $this->_shortcodes, $this); |
|
226 | 226 | |
227 | 227 | return $this->_shortcodes; |
228 | 228 | } |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | * @param mixed (object|array) $data incoming data for the parser. The data could be either an object or array because there are some shortcodes that might be replaced by prepared data that has multiple items in a list (i.e. list of attendees in an event and we're showing fname/lname for each attendee). In this case data will be in an array. Otherwise the data shoudl be in a properly formatted object. The EEH_Parse_Shortcodes.helper.php describes the data object we're expecting. |
253 | 253 | * @return string parsed shortcode |
254 | 254 | */ |
255 | - abstract protected function _parser( $shortcode ); |
|
255 | + abstract protected function _parser($shortcode); |
|
256 | 256 | |
257 | 257 | |
258 | 258 | |
@@ -264,22 +264,22 @@ discard block |
||
264 | 264 | protected function _validate_list_requirements() { |
265 | 265 | |
266 | 266 | //first test to make sure we've got an array! |
267 | - if ( !is_array($this->_data) ) { |
|
268 | - throw new EE_Error( sprintf( __('Expecting an array for the data sent to %s. Instead it was %s', 'event_espresso'), get_class($this), gettype( $this->_data ) ) ); |
|
267 | + if ( ! is_array($this->_data)) { |
|
268 | + throw new EE_Error(sprintf(__('Expecting an array for the data sent to %s. Instead it was %s', 'event_espresso'), get_class($this), gettype($this->_data))); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | //next test to make sure we've got the required template in the index! |
272 | - if ( !isset( $this->_data['template'] ) ) { |
|
273 | - throw new EE_Error( sprintf( __('The incoming data does not have the required template index in its array', 'event_espresso') ) ); |
|
272 | + if ( ! isset($this->_data['template'])) { |
|
273 | + throw new EE_Error(sprintf(__('The incoming data does not have the required template index in its array', 'event_espresso'))); |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | //next test to make sure we've got got a data index in the incoming data array |
277 | - if ( !isset( $this->_data['data'] ) ) |
|
278 | - throw new EE_Error( __('The incoming data does not have the required data index in its array', 'event_espresso') ); |
|
277 | + if ( ! isset($this->_data['data'])) |
|
278 | + throw new EE_Error(__('The incoming data does not have the required data index in its array', 'event_espresso')); |
|
279 | 279 | |
280 | 280 | //all is well let's make sure _extra_data always has the values needed. |
281 | 281 | //let's make sure that extra_data includes all templates (for later parsing if necessary) |
282 | - if ( empty( $this->_extra_data ) || ( empty( $this->_extra_data['data'] ) && empty( $this->_extra_data['template'] ) ) ) { |
|
282 | + if (empty($this->_extra_data) || (empty($this->_extra_data['data']) && empty($this->_extra_data['template']))) { |
|
283 | 283 | $this->_extra_data['data'] = $this->_data['data']; |
284 | 284 | $this->_extra_data['template'] = $this->_data['template']; |
285 | 285 | } |
@@ -296,16 +296,16 @@ discard block |
||
296 | 296 | * |
297 | 297 | * @return array An array with the attributes |
298 | 298 | */ |
299 | - protected function _get_shortcode_attrs( $shortcode ) { |
|
299 | + protected function _get_shortcode_attrs($shortcode) { |
|
300 | 300 | //make sure the required wp helper function is present |
301 | 301 | //require the shortcode file if necessary |
302 | - if ( ! function_exists( 'shortcode_parse_atts' ) ) { |
|
303 | - require_once( ABSPATH . WPINC . '/shortcodes.php'); |
|
302 | + if ( ! function_exists('shortcode_parse_atts')) { |
|
303 | + require_once(ABSPATH.WPINC.'/shortcodes.php'); |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | //let's get any attributes that may be present and set the defaults. |
307 | - $shortcode_to_parse = str_replace( '[', '', str_replace( ']', '', $shortcode ) ); |
|
308 | - return shortcode_parse_atts( $shortcode_to_parse ); |
|
307 | + $shortcode_to_parse = str_replace('[', '', str_replace(']', '', $shortcode)); |
|
308 | + return shortcode_parse_atts($shortcode_to_parse); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | */ |
321 | 321 | protected function _set_messages_properties() { |
322 | 322 | //should be in _extra_data |
323 | - if ( isset( $this->_extra_data['messenger'] ) ) { |
|
323 | + if (isset($this->_extra_data['messenger'])) { |
|
324 | 324 | $this->_messenger = $this->_extra_data['messenger']; |
325 | 325 | $this->_message_type = $this->_extra_data['message_type']; |
326 | 326 | $this->_context = $this->_extra_data['message'] instanceof EE_Message ? $this->_extra_data['message']->context() : ''; |
@@ -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,15 +15,15 @@ discard block |
||
15 | 15 | * @author Mike Nelson |
16 | 16 | * |
17 | 17 | */ |
18 | -class EE_Phone_Input extends EE_Text_Input{ |
|
18 | +class EE_Phone_Input extends EE_Text_Input { |
|
19 | 19 | /** |
20 | 20 | * @param array $options |
21 | 21 | */ |
22 | - function __construct($options = array()){ |
|
23 | - $this->_add_validation_strategy( new EE_Text_Validation_Strategy( |
|
24 | - __( 'Please enter a valid phone number. Eg 123-456-7890 or 1234567890', 'event_espresso' ), |
|
22 | + function __construct($options = array()) { |
|
23 | + $this->_add_validation_strategy(new EE_Text_Validation_Strategy( |
|
24 | + __('Please enter a valid phone number. Eg 123-456-7890 or 1234567890', 'event_espresso'), |
|
25 | 25 | '~^(([\d]{10})|([\d]{3}-[\d]{3}-[\d]{4}))$~')); |
26 | - parent::__construct( $options ); |
|
26 | + parent::__construct($options); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 |