Changeset 2918522
- Timestamp:
- 05/29/2023 10:31:14 AM (3 years ago)
- Location:
- mailbluster4wp
- Files:
-
- 48 added
- 6 edited
-
tags/1.2.1 (added)
-
tags/1.2.1/LICENSE.txt (added)
-
tags/1.2.1/README.txt (added)
-
tags/1.2.1/admin (added)
-
tags/1.2.1/admin/class-mailbluster4wp-admin.php (added)
-
tags/1.2.1/admin/class-mailbluster4wp-form-option.php (added)
-
tags/1.2.1/admin/class-mailbluster4wp-widget.php (added)
-
tags/1.2.1/admin/css (added)
-
tags/1.2.1/admin/css/mailbluster4wp-admin.css (added)
-
tags/1.2.1/admin/images (added)
-
tags/1.2.1/admin/images/admin-menu-logo.svg (added)
-
tags/1.2.1/admin/images/logo.svg (added)
-
tags/1.2.1/admin/index.php (added)
-
tags/1.2.1/admin/js (added)
-
tags/1.2.1/admin/js/mailbluster4wp-admin.js (added)
-
tags/1.2.1/admin/js/mailbluster4wp-form-builder.js (added)
-
tags/1.2.1/admin/partials (added)
-
tags/1.2.1/admin/partials/form-options (added)
-
tags/1.2.1/admin/partials/form-options/appearance.php (added)
-
tags/1.2.1/admin/partials/form-options/builder.php (added)
-
tags/1.2.1/admin/partials/form-options/messages.php (added)
-
tags/1.2.1/admin/partials/form-options/settings.php (added)
-
tags/1.2.1/admin/partials/mailbluster4wp-admin-api-display.php (added)
-
tags/1.2.1/admin/partials/mailbluster4wp-form-admin-shortcode.php (added)
-
tags/1.2.1/admin/partials/mailbluster4wp-form-description.php (added)
-
tags/1.2.1/admin/partials/mailbluster4wp-form-option.php (added)
-
tags/1.2.1/includes (added)
-
tags/1.2.1/includes/class-mailbluster4wp-activator.php (added)
-
tags/1.2.1/includes/class-mailbluster4wp-deactivator.php (added)
-
tags/1.2.1/includes/class-mailbluster4wp-helper.php (added)
-
tags/1.2.1/includes/class-mailbluster4wp-i18n.php (added)
-
tags/1.2.1/includes/class-mailbluster4wp-loader.php (added)
-
tags/1.2.1/includes/class-mailbluster4wp.php (added)
-
tags/1.2.1/includes/index.php (added)
-
tags/1.2.1/index.php (added)
-
tags/1.2.1/languages (added)
-
tags/1.2.1/languages/mailbluster4wp.pot (added)
-
tags/1.2.1/mailbluster4wp.php (added)
-
tags/1.2.1/public (added)
-
tags/1.2.1/public/class-mailbluster4wp-public.php (added)
-
tags/1.2.1/public/css (added)
-
tags/1.2.1/public/css/mailbluster4wp-public.css (added)
-
tags/1.2.1/public/index.php (added)
-
tags/1.2.1/public/js (added)
-
tags/1.2.1/public/js/mailbluster4wp-public.js (added)
-
tags/1.2.1/public/partials (added)
-
tags/1.2.1/public/partials/mailbluster4wp-public-display.php (added)
-
tags/1.2.1/uninstall.php (added)
-
trunk/README.txt (modified) (2 diffs)
-
trunk/admin/partials/form-options/builder.php (modified) (2 diffs)
-
trunk/admin/partials/mailbluster4wp-form-option.php (modified) (1 diff)
-
trunk/includes/class-mailbluster4wp-helper.php (modified) (11 diffs)
-
trunk/mailbluster4wp.php (modified) (2 diffs)
-
trunk/public/class-mailbluster4wp-public.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
mailbluster4wp/trunk/README.txt
r2836555 r2918522 6 6 Tested up to: 6.1.1 7 7 Requires PHP: 5.6 8 Stable tag: 1.2. 0.18 Stable tag: 1.2.1 9 9 License: GPLv2 or later 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 73 73 74 74 == Changelog == 75 76 =1.2.1= 77 * fix: Fail silently if can not communicate with api server. 78 * WP version 6.2.2 compatible. 75 79 76 80 = 1.2.0.1 = -
mailbluster4wp/trunk/admin/partials/form-options/builder.php
r2835808 r2918522 7 7 $form_input_field = get_post_meta($post_id, 'mb4wp_form_builder_options', true); 8 8 $form_input_field = isset($form_input_field) && !empty($form_input_field) ? $form_input_field : 'email'; 9 $custom_field = MailBluster4WP_Helper::get_custom_field(); 9 $custom_field; 10 11 $response = MailBluster4WP_Helper::get_custom_field_response(); 12 $custom_field = json_decode($response['body']); 10 13 $newArr = []; 11 14 if(isset($custom_field->fields)){ … … 159 162 $url_data = parse_url( $url ); 160 163 $url_data['host'] = explode( '.', $url_data['host'] ); 161 // unset( $url_data['host'][0] );162 164 163 165 $urlWithoutSsl = join( '.', $url_data['host'] ); 164 // echo $urlWithoutSsl;165 166 ?> 166 167 <div id="mb4wp_builder_form_branding" class="mb4wp-form-branding" style="display: <?php echo (isset($show_branding) && ($show_branding == 'yes')) ? "block" : "none"; ?>"> -
mailbluster4wp/trunk/admin/partials/mailbluster4wp-form-option.php
r2776930 r2918522 11 11 */ 12 12 13 $response = MailBluster4WP_Helper::get_custom_field_response(); 14 if(is_wp_error($response)){ 15 $content = '<h3 style="font-weight:normal;">Loading form option...</h3>'; 16 echo $content; 17 return; 18 } 13 19 ?> 14 20 <div id="mailbluster-form-options"> -
mailbluster4wp/trunk/includes/class-mailbluster4wp-helper.php
r2835808 r2918522 242 242 // Prepare form input detail 243 243 $form_input_detail = self::mb4wp_process_form_input_fields($post_id); 244 245 if(empty($form_input_detail)){ 246 return false; 247 } 244 248 245 249 // Get form wrapper class … … 331 335 $url_data = parse_url( $url ); 332 336 $url_data['host'] = explode( '.', $url_data['host'] ); 333 // unset( $url_data['host'][0] );334 337 335 338 $urlWithoutSsl = join( '.', $url_data['host'] ); 336 // echo $urlWithoutSsl;337 339 ?> 338 340 <div class="mb4wp-form-branding"> … … 367 369 $prefix_s = 'mb4wp_sform_'; 368 370 $prefix_n_ar = $prefix_s . intval($post_id); 369 370 $custom_fields = self::get_custom_field()->fields; 371 $custom_fields = []; 372 373 $response = self::get_custom_field_response(); 374 if(is_wp_error($response)){ 375 return []; 376 } else { 377 $custom_fields = json_decode($response['body'])->fields; 378 } 379 371 380 $custom_field_label = []; 372 381 foreach ( $custom_fields as $custom_field ) { … … 387 396 $single_field_str = $single_field; 388 397 } 389 // if('*' == substr($single_field, -1)){ 390 // $single_field = substr($single_field, 0, -1); 391 // }; 392 // $single_field = str_replace('_', ' ', trim($single_field)); 393 // $form_detailed[$single_field_key] = array( 394 // 'id' => $prefix_s . $single_field_key, 395 // 'name' => $prefix_n_ar . '[meta][' . $single_field_key . ']', 396 // 'placeholder' => $single_field, 397 // 'required' => $required 398 // ); 398 399 399 if('email' == $single_field_str){ 400 400 $form_detailed['email'] = array( … … 441 441 442 442 /** 443 * Get the data of custom field from app.mailbluster.com dashboard444 * 445 * @return array| string|WP_Error446 */ 447 public static function get_custom_field (){443 * Get the response data of custom field from app.mailbluster.com dashboard 444 * 445 * @return array|WP_Error 446 */ 447 public static function get_custom_field_response(){ 448 448 449 449 // Set custom field API 450 $ lead_url = 'https://api.mailbluster.com/api/fields';450 $url = 'https://api.mailbluster.com/api/fields'; 451 451 452 452 // Get response by hitting API 453 $response = wp_safe_remote_get(esc_url_raw($ lead_url), array(453 $response = wp_safe_remote_get(esc_url_raw($url), array( 454 454 'headers' => array( 455 455 'Content-Type' => 'application/json', … … 458 458 )); 459 459 460 return json_decode($response['body']);460 return $response; 461 461 } 462 462 … … 534 534 } 535 535 } 536 // foreach ($meta_form_data as $single_data => $value) { 537 // $key = self::mb4wp_make_camel_case($single_data); 538 // $request_meta[$key] = self::mb4wp_sanitize_value_of_key($single_data, $value); 539 // $request_body['meta'] = $request_meta; 540 // } 536 541 537 foreach ($custom_form_data as $single_data => $value) { 542 538 $key = self::mb4wp_make_camel_case($single_data); … … 587 583 $builder_options = explode(',', sanitize_text_field(get_post_meta($post_id, 'mb4wp_form_builder_options', true))); 588 584 589 // foreach($request_body['meta'] as $k => $v){590 591 // if('*' == substr($k, -1)){592 // $newKey = substr($k, 0, -1);593 // $request_body['meta'][$newKey] = $v;594 // // var_dump($request_body['meta'][$k]);595 // // die;596 // if(empty($request_body['meta'][$newKey])){597 // return;598 // }599 // unset($request_body['meta'][$k]);600 // }601 // }602 603 585 foreach($request_body['fields'] as $k => $v){ 604 586 … … 620 602 foreach($request_body as $key => $value){ 621 603 622 // if($key == 'meta' && !empty(is_array($request_body[$key]))){623 // foreach($request_body[$key] as $metaKey => $metaValue){624 625 // if($requireItem == $metaKey && empty($metaValue) ){626 // return;627 // }628 // }629 // }630 631 604 if($key == 'fields' && !empty(is_array($request_body[$key]))){ 632 605 foreach($request_body[$key] as $metaKey => $metaValue){ … … 658 631 $tags = explode(', ', $terms_string); 659 632 } 660 661 // Filter request body's meta array property662 // $request_body['meta'] = array_filter((array) $request_body['meta']);663 633 664 634 // Filter request body's custom fields array property … … 704 674 </script>'; 705 675 } 706 707 // var_dump($request_body);708 // die();709 676 710 677 // Return response -
mailbluster4wp/trunk/mailbluster4wp.php
r2836555 r2918522 17 17 * Plugin URI: https://mailbluster.com 18 18 * Description: A free and simple WordPress plugin for MailBluster which provides different methods to create and include subscription forms into WordPress pages or posts by utilizing AmazonSES service. 19 * Version: 1.2. 0.120 * Tested up to: 6.1.119 * Version: 1.2.1 20 * Tested up to: 6.2.2 21 21 * Author: MailBluster 22 22 * Author URI: https://mailbluster.com … … 37 37 * Rename this for your plugin and update it as you release new versions. 38 38 */ 39 define('MAILBLUSTER4WP_VERSION', '1.2. 0.1');39 define('MAILBLUSTER4WP_VERSION', '1.2.1'); 40 40 41 41 /** -
mailbluster4wp/trunk/public/class-mailbluster4wp-public.php
r2793017 r2918522 115 115 'id' => '' 116 116 ), $atts )); 117 $form_title = get_the_title(intval($id));118 $form_description = get_post_meta(intval($id), 'mb4wp_form_description', true);119 $appearance_theme = MailBluster4WP_Helper::mb4wp_get_appearance_by_key('theme', intval($id));117 $form_title = get_the_title(intval($id)); 118 $form_description = get_post_meta(intval($id), 'mb4wp_form_description', true); 119 $appearance_theme = MailBluster4WP_Helper::mb4wp_get_appearance_by_key('theme', intval($id)); 120 120 $appearance_background_color = MailBluster4WP_Helper::mb4wp_get_appearance_by_key('background_color', intval($id)); 121 $appearance_color = MailBluster4WP_Helper::mb4wp_get_appearance_by_key('text_color', intval($id));121 $appearance_color = MailBluster4WP_Helper::mb4wp_get_appearance_by_key('text_color', intval($id)); 122 122 $appearance_titleTextSize = MailBluster4WP_Helper::mb4wp_get_appearance_by_key('titleTextSize', intval($id)); 123 123 $appearance_titleMarginTop = MailBluster4WP_Helper::mb4wp_get_appearance_by_key('titleMarginTop', intval($id)); 124 124 $appearance_titleMarginRight = MailBluster4WP_Helper::mb4wp_get_appearance_by_key('titleMarginRight', intval($id)); 125 $appearance_titleMarginBottom = MailBluster4WP_Helper::mb4wp_get_appearance_by_key('titleMarginBottom', intval($id));125 $appearance_titleMarginBottom = MailBluster4WP_Helper::mb4wp_get_appearance_by_key('titleMarginBottom', intval($id)); 126 126 $appearance_titleMarginLeft = MailBluster4WP_Helper::mb4wp_get_appearance_by_key('titleMarginLeft', intval($id)); 127 $appearance_formPaddingY = MailBluster4WP_Helper::mb4wp_get_appearance_by_key('formPaddingY', intval($id)); 128 $appearance_formPaddingX = MailBluster4WP_Helper::mb4wp_get_appearance_by_key('formPaddingX', intval($id)); 127 $appearance_formPaddingY = MailBluster4WP_Helper::mb4wp_get_appearance_by_key('formPaddingY', intval($id)); 128 $appearance_formPaddingX = MailBluster4WP_Helper::mb4wp_get_appearance_by_key('formPaddingX', intval($id)); 129 130 $render_form = MailBluster4WP_Helper::mb4wp_render_form(intval($id)); 131 132 if(!$render_form){ 133 return false; 134 } 135 129 136 ob_start(); 130 137 ?> … … 142 149 <?php 143 150 } 144 if(!empty($form_description)) {145 echo '<p>'.esc_html($form_description).'</p>';151 if(!empty($form_description)) { 152 echo '<p>'.esc_html($form_description).'</p>'; 146 153 } 147 echo MailBluster4WP_Helper::mb4wp_render_form(intval($id));148 ?>154 echo $render_form; 155 ?> 149 156 </div> 150 157 </div>
Note: See TracChangeset
for help on using the changeset viewer.