Changeset 2225635
- Timestamp:
- 01/10/2020 08:28:00 PM (6 years ago)
- Location:
- wp-emfluence/trunk
- Files:
-
- 6 edited
-
admin.php (modified) (1 diff)
-
emfluence.php (modified) (1 diff)
-
notification/template-field.html (modified) (1 diff)
-
notification/template.html (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
widget.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-emfluence/trunk/admin.php
r1914929 r2225635 118 118 if(empty($data['api_key'])) return $data; 119 119 120 // Create a new instance of the api 121 $api = emfluence_get_api($data['api_key'], TRUE); 122 123 // Ensure it works 124 $result = $api->ping(); 120 try { 121 $api = emfluence_get_api($data['api_key'], TRUE); 122 // Ensure it works 123 $result = $api->ping(); 124 } catch(Exception $e) { 125 $result = FALSE; 126 $exception_message = $e->getMessage(); 127 } 125 128 if( !$result || !$result->success ){ 126 $message = __('Unable to access the API using the api key provided. Error message: ') . $api->errors->get_last(); 129 $message = __('Unable to access the API using the api key provided. Error message: ') . 130 (empty($exception_message) ? $api->errors->get_last(): $exception_message); 127 131 add_settings_error( 'api_key', 'api_key', $message , 'error' ); 128 132 $data['api_key'] = ''; -
wp-emfluence/trunk/emfluence.php
r1970139 r2225635 5 5 Description: Easily add forms to your website for contacts to add or update their details in your emfluence Marketing Platform account. 6 6 Author: emfluence Digital Marketing 7 Version: 2. 7.17 Version: 2.8 8 8 Author URI: https://www.emfluence.com 9 9 Text Domain: emfl_form -
wp-emfluence/trunk/notification/template-field.html
r1914929 r2225635 1 <tr valign="top" >1 <tr valign="top" class="{{alternating}}"> 2 2 <td width="145"><label>{{label}}</label></td> 3 3 <td>{{value}}</td> -
wp-emfluence/trunk/notification/template.html
r1914929 r2225635 243 243 <tbody> 244 244 <tr> 245 <td width="558" align="center"><span style="font-size:11px; font-family:Arial, Helvetica, sans-serif; color:#c2c6c9;"><strong>emfluence</strong> 1 06 W. 11th Street, Ste. 2220, Kansas City, MO 64105</span></td>245 <td width="558" align="center"><span style="font-size:11px; font-family:Arial, Helvetica, sans-serif; color:#c2c6c9;"><strong>emfluence</strong> 1720 Wyandotte St, Kansas City, MO 64108</span></td> 246 246 </tr> 247 247 </tbody> -
wp-emfluence/trunk/readme.txt
r2044686 r2225635 2 2 Tags: email, email marketing, emailmarketing, emfluence, api, marketing automation, widget, email widget, email signup, mailing list, newsletter, form, automation 3 3 Requires at least: 4.0 4 Tested up to: 5. 15 Stable tag: 2. 7.14 Tested up to: 5.3.2 5 Stable tag: 2.8 6 6 Requires PHP: 5.6 7 7 Contributors: emfluencekc, mightyturtle … … 57 57 == Changelog == 58 58 59 = 2.8 = 60 * Minor style update to notification email. 61 * Minor improvements to emfluence API exception handling. 62 59 63 = 2.7.1 = 60 64 * Performance improvement for admins. -
wp-emfluence/trunk/widget.php
r1970139 r2225635 33 33 34 34 $options = get_option('emfluence_global'); 35 $api = emfluence_get_api($options['api_key']); 35 try { 36 $api = emfluence_get_api($options['api_key']); 37 } catch(Exception $e) { 38 return NULL; 39 } 36 40 $groups = array(); 37 41 $more = TRUE; … … 225 229 if( empty($messages) ){ 226 230 // Try to subscribe them 227 $options = get_option('emfluence_global');228 $api = emfluence_get_api($options['api_key']);229 231 230 232 $data = array(); … … 277 279 if(empty($data['customFields'])) unset($data['customFields']); 278 280 279 $result = $api->contacts_save($data); 281 try { 282 $options = get_option('emfluence_global'); 283 $api = emfluence_get_api($options['api_key']); 284 $result = $api->contacts_save($data); 285 } catch(Exception $e) { 286 $result = NULL; 287 } 280 288 281 289 if( empty($result) ) { … … 434 442 $fields_html = array(); 435 443 $field_template = file_get_contents(__DIR__ . '/notification/template-field.html'); 444 $alternating = 'even'; // a class that alternates on each row between "even" and "odd". 436 445 foreach($data as $field=>$val) { 446 $alternating = ('even' === $alternating) ? 'odd' : 'even'; 437 447 if($field == 'customFields') { 438 448 foreach($val as $custom_id=>$custom_val) { … … 445 455 $custom_val['value'] = wpautop($custom_val['value']); 446 456 } 447 $fields_html[] = str_replace(array('{{label}}', '{{value}}' ), array($label, $custom_val['value']), $field_template);457 $fields_html[] = str_replace(array('{{label}}', '{{value}}', '{{alternating}}'), array($label, $custom_val['value'], $alternating), $field_template); 448 458 } 449 459 continue; 450 460 } 451 $fields_html[] = str_replace(array('{{label}}', '{{value}}' ), array($field, $this->recursively_convert_to_string($val)), $field_template);461 $fields_html[] = str_replace(array('{{label}}', '{{value}}', '{{alternating}}'), array($field, $this->recursively_convert_to_string($val), $alternating), $field_template); 452 462 } 453 463 $intro = (empty($instance['notify-intro']) ? '' : wpautop($instance['notify-intro'])); … … 985 995 return; 986 996 } 987 $api = emfluence_get_api($options['api_key']);988 997 static $ping = NULL; 989 if(NULL === $ping) $ping = $api->ping(); 990 if( !$ping || !$ping->success ){ 998 try { 999 $api = emfluence_get_api($options['api_key']); 1000 if (NULL === $ping) $ping = $api->ping(); 1001 } catch(Exception $e) {} 1002 if( (NULL === $ping) || !$ping || !$ping->success ){ 991 1003 $output = '<h3>' . __('Authentication Failed') . '</h3>'; 992 1004 $output .= '<p>' . __('Please check your api key to continue.') . '</p>';
Note: See TracChangeset
for help on using the changeset viewer.