@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -184,9 +184,9 @@ discard block |
||
184 | 184 | * @access protected |
185 | 185 | * @param string $messenger |
186 | 186 | */ |
187 | - protected function _set_existing_admin_settings( $messenger = '' ) { |
|
187 | + protected function _set_existing_admin_settings($messenger = '') { |
|
188 | 188 | /** @var EE_Message_Resource_Manager $Message_Resource_Manager */ |
189 | - $Message_Resource_Manager = EE_Registry::instance()->load_lib( 'Message_Resource_Manager' ); |
|
189 | + $Message_Resource_Manager = EE_Registry::instance()->load_lib('Message_Resource_Manager'); |
|
190 | 190 | $active_messengers = $Message_Resource_Manager->get_active_messengers_option(); |
191 | 191 | $settings_to_use = $active_messengers; |
192 | 192 | |
@@ -194,14 +194,14 @@ discard block |
||
194 | 194 | * This determines what will be used for the getting the settings. |
195 | 195 | */ |
196 | 196 | if ( |
197 | - ! empty( $messenger ) |
|
198 | - && $Message_Resource_Manager->is_message_type_active_for_messenger( $messenger, $this->name ) |
|
197 | + ! empty($messenger) |
|
198 | + && $Message_Resource_Manager->is_message_type_active_for_messenger($messenger, $this->name) |
|
199 | 199 | ) { |
200 | - $settings_to_use = $active_messengers[ $messenger ]['settings'][ $messenger . '-message_types' ]; |
|
200 | + $settings_to_use = $active_messengers[$messenger]['settings'][$messenger.'-message_types']; |
|
201 | 201 | } |
202 | 202 | |
203 | - $this->_existing_admin_settings = isset( $settings_to_use[ $this->name ]['settings'] ) |
|
204 | - ? $settings_to_use[ $this->name ]['settings'] |
|
203 | + $this->_existing_admin_settings = isset($settings_to_use[$this->name]['settings']) |
|
204 | + ? $settings_to_use[$this->name]['settings'] |
|
205 | 205 | : null; |
206 | 206 | } |
207 | 207 | |
@@ -218,12 +218,12 @@ discard block |
||
218 | 218 | * @param string $messenger |
219 | 219 | * @return array settings |
220 | 220 | */ |
221 | - public function get_existing_admin_settings( $messenger = '' ) { |
|
221 | + public function get_existing_admin_settings($messenger = '') { |
|
222 | 222 | // if admin_settings property empty lets try setting it. |
223 | - if ( method_exists($this, '_set_existing_admin_settings') && empty( $this->_existing_admin_settings ) ) { |
|
224 | - $this->_set_existing_admin_settings( $messenger ); |
|
223 | + if (method_exists($this, '_set_existing_admin_settings') && empty($this->_existing_admin_settings)) { |
|
224 | + $this->_set_existing_admin_settings($messenger); |
|
225 | 225 | } |
226 | - return property_exists( $this, '_existing_admin_settings' ) |
|
226 | + return property_exists($this, '_existing_admin_settings') |
|
227 | 227 | ? $this->_existing_admin_settings |
228 | 228 | : null; |
229 | 229 | } |
@@ -239,12 +239,12 @@ discard block |
||
239 | 239 | */ |
240 | 240 | public function get_valid_shortcodes() { |
241 | 241 | $valid_shortcodes = apply_filters( |
242 | - 'FHEE__' . get_class( $this ) . '__get_valid_shortcodes', |
|
242 | + 'FHEE__'.get_class($this).'__get_valid_shortcodes', |
|
243 | 243 | $this->_valid_shortcodes, |
244 | 244 | $this |
245 | 245 | ); |
246 | 246 | //The below filter applies to ALL messengers and message types so use with care! |
247 | - $valid_shortcodes = apply_filters( 'FHEE__EE_Messages_Base__get_valid_shortcodes', $valid_shortcodes, $this ); |
|
247 | + $valid_shortcodes = apply_filters('FHEE__EE_Messages_Base__get_valid_shortcodes', $valid_shortcodes, $this); |
|
248 | 248 | return $valid_shortcodes; |
249 | 249 | } |
250 | 250 | |
@@ -278,23 +278,23 @@ discard block |
||
278 | 278 | * @access protected |
279 | 279 | * @return string $content for page. |
280 | 280 | */ |
281 | - protected function _get_admin_page_content( $page, $action, $extra, $actives ) { |
|
281 | + protected function _get_admin_page_content($page, $action, $extra, $actives) { |
|
282 | 282 | //we can also further refine the context by action (if present). |
283 | - if ( !empty($action) ) { |
|
284 | - $page = $page . '_' . $action; |
|
283 | + if ( ! empty($action)) { |
|
284 | + $page = $page.'_'.$action; |
|
285 | 285 | } |
286 | 286 | |
287 | - if ( !isset( $this->admin_registered_pages[$page]) ){ |
|
287 | + if ( ! isset($this->admin_registered_pages[$page])) { |
|
288 | 288 | // todo: a place to throw an exception? |
289 | 289 | // We need to indicate there is no registered page so this function is not being called correctly. |
290 | 290 | return false; |
291 | 291 | } |
292 | 292 | //k made it here so let's call the method |
293 | 293 | $content = call_user_func_array( |
294 | - array( $this, '_get_admin_content_' . $page ), |
|
295 | - array( $actives, $extra ) |
|
294 | + array($this, '_get_admin_content_'.$page), |
|
295 | + array($actives, $extra) |
|
296 | 296 | ); |
297 | - if ( $content === false ) { |
|
297 | + if ($content === false) { |
|
298 | 298 | // todo this needs to be an exception once we've got exceptions in place. |
299 | 299 | return false; |
300 | 300 | } |
@@ -1,6 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * EE_Messages_Base class |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('No direct script access allowed'); |
4 | 4 | |
5 | 5 | |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | * classname to create an alternative index for retrieving data_handlers. |
27 | 27 | * @return bool |
28 | 28 | */ |
29 | - public function add( $data_handler, $data = null) { |
|
29 | + public function add($data_handler, $data = null) { |
|
30 | 30 | $data = $data === null ? array() : (array) $data; |
31 | - $info['key'] = $this->get_key( get_class( $data_handler ), $data ); |
|
32 | - return parent::add( $data_handler, $info ); |
|
31 | + $info['key'] = $this->get_key(get_class($data_handler), $data); |
|
32 | + return parent::add($data_handler, $info); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return string md5 hash using provided info. |
46 | 46 | */ |
47 | - public function get_key( $classname, $data ) { |
|
48 | - return md5( $classname . print_r( $data, true ) ); |
|
47 | + public function get_key($classname, $data) { |
|
48 | + return md5($classname.print_r($data, true)); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @return null|EE_Messages_incoming_data |
63 | 63 | */ |
64 | - public function get_by_key( $key ) { |
|
64 | + public function get_by_key($key) { |
|
65 | 65 | $this->rewind(); |
66 | - while( $this->valid() ) { |
|
66 | + while ($this->valid()) { |
|
67 | 67 | $data = $this->getInfo(); |
68 | - if ( isset( $data['key'] ) && $data['key'] === $key ) { |
|
68 | + if (isset($data['key']) && $data['key'] === $key) { |
|
69 | 69 | $handler = $this->current(); |
70 | 70 | $this->rewind(); |
71 | 71 | return $handler; |
@@ -1,6 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('No direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | |
6 | 7 | /** |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('No direct script access allowed'); |
4 | 4 | |
5 | 5 | |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | $this->interface = 'EE_Messages_Template_Pack'; |
18 | 18 | } |
19 | 19 | |
20 | - public function get_by_name( $template_pack_name ) { |
|
20 | + public function get_by_name($template_pack_name) { |
|
21 | 21 | $this->rewind(); |
22 | - while ( $this->valid() ) { |
|
23 | - if ( $this->current()->dbref == $template_pack_name ) { |
|
22 | + while ($this->valid()) { |
|
23 | + if ($this->current()->dbref == $template_pack_name) { |
|
24 | 24 | return $this->current(); |
25 | 25 | } |
26 | 26 | $this->next(); |
@@ -1,6 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION')) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | 3 | exit('No direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | |
6 | 7 | /** |
@@ -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( |
@@ -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,7 +1,8 @@ |
||
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 | * EE_Messages_REG_incoming_data |
@@ -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,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() : ''; |
@@ -22,7 +22,6 @@ |
||
22 | 22 | /** |
23 | 23 | * Removes the checkin and checkout endpoints from the index for requests |
24 | 24 | * to api versions lowers than 4.8.33 |
25 | - * @param array $routes_on_this_version |
|
26 | 25 | * @param EventEspresso\core\libraries\rest_api\controllers\Base $controller |
27 | 26 | * @return array like $routes_on_this_version |
28 | 27 | */ |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | //is for lower than 4.8.33 |
14 | 14 | add_filter( |
15 | 15 | 'FHEE__EventEspresso\core\libraries\rest_api\controllers\Base___get_response_headers', |
16 | - array( $this, 'remove_response_headers' ), |
|
16 | + array($this, 'remove_response_headers'), |
|
17 | 17 | 10, |
18 | 18 | 3 |
19 | 19 | ); |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | * @param EventEspresso\core\libraries\rest_api\controllers\Base $controller |
27 | 27 | * @return array like $routes_on_this_version |
28 | 28 | */ |
29 | - public function remove_response_headers( $response_headers, $controller, $requested_version ) { |
|
30 | - if( $controller instanceof Base |
|
31 | - && $this->applies_to_version( $requested_version ) ) { |
|
29 | + public function remove_response_headers($response_headers, $controller, $requested_version) { |
|
30 | + if ($controller instanceof Base |
|
31 | + && $this->applies_to_version($requested_version)) { |
|
32 | 32 | return array(); |
33 | 33 | } |
34 | 34 | return $response_headers; |
@@ -6,22 +6,22 @@ |
||
6 | 6 | * @subpackage |
7 | 7 | * @author Mike Nelson |
8 | 8 | */ |
9 | -class EE_Email_Input extends EE_Form_Input_Base{ |
|
9 | +class EE_Email_Input extends EE_Form_Input_Base { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * @param array $input_settings |
13 | 13 | */ |
14 | - function __construct( $input_settings = array() ){ |
|
15 | - $this->_set_display_strategy( new EE_Text_Input_Display_Strategy('email') ); |
|
16 | - $this->_set_normalization_strategy( new EE_Text_Normalization() ); |
|
14 | + function __construct($input_settings = array()) { |
|
15 | + $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('email')); |
|
16 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
17 | 17 | $this->_add_validation_strategy( |
18 | 18 | new EE_Email_Validation_Strategy( |
19 | - isset( $input_settings[ 'validation_error_message' ] ) |
|
20 | - ? $input_settings[ 'validation_error_message' ] |
|
19 | + isset($input_settings['validation_error_message']) |
|
20 | + ? $input_settings['validation_error_message'] |
|
21 | 21 | : NULL |
22 | 22 | ) |
23 | 23 | ); |
24 | - parent::__construct( $input_settings ); |
|
25 | - $this->set_html_class( $this->html_class() . ' email' ); |
|
24 | + parent::__construct($input_settings); |
|
25 | + $this->set_html_class($this->html_class().' email'); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | \ No newline at end of file |