Business Profile - Version 2.0.8

Version Description

(2020-08-12) = - Fix for the initial walk-through and the chosen contact page not being populated - Fix for default values not being applied - Correcting/eliminating several PHP notices - CSS updates for the admin panel - Enhanced upgrade process

Download this release

Release Info

Developer Rustaurius
Plugin Icon 128x128 Business Profile
Version 2.0.8
Comparing to
See all releases

Code changes from version 2.0.7 to 2.0.8

assets/css/admin.css CHANGED
@@ -1347,7 +1347,8 @@ NEW DASHBOARD
1347
  z-index: 2;
1348
  }
1349
  .business-profile_page_bpfwp-settings .wrap form .form-table {
1350
- width: 90%;
 
1351
  margin: 0 auto 16px;
1352
  box-shadow: 0 1px 12px #ddd;
1353
  display: block;
@@ -1871,4 +1872,9 @@ NEW
1871
  }
1872
  .bpfwp-meta-input {
1873
  float: left;
 
 
 
 
 
1874
  }
1347
  z-index: 2;
1348
  }
1349
  .business-profile_page_bpfwp-settings .wrap form .form-table {
1350
+ width: 100%;
1351
+ box-sizing: border-box;
1352
  margin: 0 auto 16px;
1353
  box-shadow: 0 1px 12px #ddd;
1354
  display: block;
1872
  }
1873
  .bpfwp-meta-input {
1874
  float: left;
1875
+ }
1876
+
1877
+ #bpfwp_schema_targeting_information .inside {
1878
+ display: inline-block;
1879
+ width: 100%;
1880
  }
business-profile.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Five Star Business Profile and Schema
4
  * Plugin URI: https://www.fivestarplugins.com/plugins/business-profile/
5
  * Description: Add schema structured data to any page or post type. Create an SEO friendly contact card with your business info and associated schema. Supports Google Map, opening hours and more.
6
- * Version: 2.0.7
7
  * Author: Five Star Plugins
8
  * Author URI: https://www.fivestarplugins.com
9
  * License: GPLv3
@@ -160,6 +160,7 @@ if ( ! class_exists( 'bpfwpInit', false ) ) :
160
  add_action( 'wp_enqueue_scripts', array( $this, 'register_assets' ) );
161
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
162
  add_action( 'widgets_init', array( $this, 'register_widgets' ) );
 
163
  add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 );
164
  }
165
 
@@ -322,6 +323,24 @@ if ( ! class_exists( 'bpfwpInit', false ) ) :
322
  }
323
  }
324
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  /**
326
  * Return a single instance of the main plugin class.
327
  *
3
  * Plugin Name: Five Star Business Profile and Schema
4
  * Plugin URI: https://www.fivestarplugins.com/plugins/business-profile/
5
  * Description: Add schema structured data to any page or post type. Create an SEO friendly contact card with your business info and associated schema. Supports Google Map, opening hours and more.
6
+ * Version: 2.0.8
7
  * Author: Five Star Plugins
8
  * Author URI: https://www.fivestarplugins.com
9
  * License: GPLv3
160
  add_action( 'wp_enqueue_scripts', array( $this, 'register_assets' ) );
161
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_assets' ) );
162
  add_action( 'widgets_init', array( $this, 'register_widgets' ) );
163
+ add_filter( 'the_content', array( $this, 'append_to_content' ) );
164
  add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 );
165
  }
166
 
323
  }
324
  }
325
 
326
+ /**
327
+ * Append contact card to a post's $content variable
328
+ * @since 2.0.8
329
+ */
330
+ function append_to_content( $content ) {
331
+ global $post;
332
+
333
+ if ( !is_main_query() || !in_the_loop() || post_password_required() ) {
334
+ return $content;
335
+ }
336
+
337
+ if ( $post->ID == $this->settings->get_setting( 'contact-page' ) ) {
338
+ return $content . bpwfwp_print_contact_card();
339
+ }
340
+
341
+ return $content;
342
+ }
343
+
344
  /**
345
  * Return a single instance of the main plugin class.
346
  *
includes/class-dashboard.php CHANGED
@@ -14,10 +14,6 @@ class bpfwpDashboard {
14
 
15
  public function __construct() {
16
  add_action( 'admin_menu', array( $this, 'add_dashboard_to_menu' ), 99 );
17
- if ( isset($_POST['BPFWP_Upgrade_To_Full']) ) { add_action( 'init', array( $this, 'check_upgrade_code' ) ); }
18
- if ( get_option( 'BPFWP_Trial_Happening' ) == 'Yes' ) {
19
- add_action('admin_init', array( $this, 'check_trial_status' ) );
20
- }
21
 
22
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
23
  }
@@ -69,68 +65,6 @@ class bpfwpDashboard {
69
  }
70
  }
71
 
72
- public function check_upgrade_code() {
73
- global $bpfwp_controller;
74
-
75
- $key = trim($_POST['Key']);
76
-
77
- if ($key == "FSP Trial" and !get_option("BPFWP_Trial_Happening")) {
78
- $this->message = __("Trial successfully started!", 'business-profile');
79
-
80
- update_option("BPFWP_Trial_Expiry_Time", time() + (7*24*60*60));
81
- update_option("BPFWP_Trial_Happening", "Yes");
82
-
83
- update_option( "bpfwp-pre-permission-level", get_option( 'bpfwp-permission-level' ) );
84
- update_option( "bpfwp-permission-level", 2 );
85
- $bpfwp_controller->permissions->update_permissions();
86
-
87
- $Admin_Email = get_option('admin_email');
88
-
89
- $opts = array('http'=>array('method'=>"GET"));
90
- $context = stream_context_create($opts);
91
- $Response = file_get_contents("http://www.fivestarplugins.com/key-check/Register_Trial.php?Plugin=BPFWP&Admin_Email=" . $Admin_Email . "&Site=" . get_bloginfo('wpurl'), false, $context);
92
- }
93
- elseif ($key == "FSP Trial") {
94
- $this->status = false;
95
- $this->message = __('Trial has already been used.', 'business-profile');
96
- }
97
- elseif (strlen($key) < 18 or strlen($key) > 22) {
98
- $this->status = false;
99
- $this->message = __('Invalid License Key', 'business-profile');
100
- }
101
- elseif ($key != "FSP Trial") {
102
- $opts = array('http'=>array('method'=>"GET"));
103
- $context = stream_context_create($opts);
104
- $Response = unserialize(file_get_contents("http://www.fivestarplugins.com/key-check/FSP_BPFWP_KeyCheck.php?Key=" . $key . "&Site=" . get_bloginfo('wpurl'), false, $context));
105
- print_r($Response);
106
- if ($Response['Message_Type'] == "Error") {
107
- $this->status = false;
108
- $this->message = $Response['Message'];
109
- }
110
- else {
111
- $this->message = $Response['Message'];
112
- update_option("BPFWP_Trial_Happening", "No");
113
- delete_option("BPFWP_Trial_Expiry_Time");
114
-
115
- update_option( "bpfwp-permission-level", 2 );
116
- $bpfwp_controller->permissions->update_permissions();
117
- }
118
- }
119
-
120
- add_action( 'admin_notices', array( $this, 'display_notice' ) );
121
- }
122
-
123
- public function check_trial_status() {
124
- global $bpfwp_controller;
125
-
126
- if ( get_option("BPFWP_Trial_Happening") == "Yes" and get_option( 'BPFWP_Trial_Expiry_Time' ) < time() ) {
127
- update_option( 'BPFWP_Trial_Happening', 'No');
128
- update_option( 'bpfwp-permission-level', get_option( 'bpfwp-pre-permission-level' ) );
129
-
130
- $bpfwp_controller->permissions->update_permissions();
131
- }
132
- }
133
-
134
  public function display_dashboard_screen() {
135
  global $bpfwp_controller;
136
 
@@ -141,17 +75,15 @@ class bpfwpDashboard {
141
 
142
  <div id="bpfwp-dashboard-content-left">
143
 
144
- <?php if ( ! $permission or get_option("BPFWP_Trial_Happening") == "Yes") { ?>
145
- <div class="bpfwp-dashboard-new-widget-box ewd-widget-box-full">
146
- <div class="bpfwp-dashboard-new-widget-box-top">
147
- <form method="post" action="admin.php?page=bpfwp-dashboard" class="bpfwp-dashboard-key-widget">
148
- <input class="bpfwp-dashboard-key-widget-input" name="Key" type="text" placeholder="<?php _e('Enter License Key Here', 'business-profile'); ?>">
149
- <input class="bpfwp-dashboard-key-widget-submit" name="BPFWP_Upgrade_To_Full" type="submit" value="<?php _e('UNLOCK PREMIUM', 'business-profile'); ?>">
150
- <div class="bpfwp-dashboard-key-widget-text">Don't have a key? <a href="https://www.fivestarplugins.com/license-payment/?Selected=BPFWP&Quantity=1" target="_blank">Upgrade Now</a> to unlock all premium features.</div>
151
- </form>
152
- </div>
153
- </div>
154
- <?php } ?>
155
 
156
  <div class="bpfwp-dashboard-new-widget-box ewd-widget-box-full" id="bpfwp-dashboard-support-widget-box">
157
  <div class="bpfwp-dashboard-new-widget-box-top">Get Support<span id="bpfwp-dash-mobile-support-down-caret">&nbsp;&nbsp;&#9660;</span><span id="bpfwp-dash-mobile-support-up-caret">&nbsp;&nbsp;&#9650;</span></div>
@@ -284,45 +216,33 @@ class bpfwpDashboard {
284
  </div> <!-- left -->
285
 
286
  <div id="bpfwp-dashboard-content-right">
287
-
288
  <?php if ( ! $permission or get_option("BPFWP_Trial_Happening") == "Yes" ) { ?>
289
- <div class="bpfwp-dashboard-new-widget-box ewd-widget-box-full" id="bpfwp-dashboard-get-premium-widget-box">
290
  <div class="bpfwp-dashboard-new-widget-box-top">Get Premium</div>
291
- <?php if(get_option("BPFWP_Trial_Happening") == "Yes"){
292
- $trialExpireTime = get_option("BPFWP_Trial_Expiry_Time");
293
- $currentTime = time();
294
- $trialTimeLeft = $trialExpireTime - $currentTime;
295
- $trialTimeLeftDays = ( date("d", $trialTimeLeft) ) - 1;
296
- $trialTimeLeftHours = date("H", $trialTimeLeft);
297
- ?>
298
- <div class="bpfwp-dashboard-new-widget-box-bottom">
299
- <div class="bpfwp-dashboard-get-premium-widget-trial-time">
300
- <div class="bpfwp-dashboard-get-premium-widget-trial-days"><?php echo $trialTimeLeftDays; ?><span>days</span></div>
301
- <div class="bpfwp-dashboard-get-premium-widget-trial-hours"><?php echo $trialTimeLeftHours; ?><span>hours</span></div>
302
- </div>
303
- <div class="bpfwp-dashboard-get-premium-widget-trial-time-left">LEFT IN TRIAL</div>
304
- </div>
305
- <?php } ?>
306
  <div class="bpfwp-dashboard-new-widget-box-bottom">
307
  <div class="bpfwp-dashboard-get-premium-widget-features-title"<?php echo ( get_option("BPFWP_Trial_Happening") == "Yes" ? "style='padding-top: 20px;'" : ""); ?>>GET FULL ACCESS WITH OUR PREMIUM VERSION AND GET:</div>
308
  <ul class="bpfwp-dashboard-get-premium-widget-features">
309
- <li>Multiple Layouts</li>
310
- <li>Custom Fields</li>
311
- <li>MailChimp Integration</li>
312
- <li>Advanced Styling Options</li>
313
  <li>+ More</li>
314
  </ul>
315
  <a href="https://www.fivestarplugins.com/license-payment/?Selected=BPFWP&Quantity=1" class="bpfwp-dashboard-get-premium-widget-button" target="_blank">UPGRADE NOW</a>
316
- <?php if (!get_option("BPFWP_Trial_Happening")) { ?>
317
- <form method="post" action="admin.php?page=bpfwp-dashboard">
318
- <input name="Key" type="hidden" value='FSP Trial'>
319
- <input name="BPFWP_Upgrade_To_Full" type="hidden" value='BPFWP_Upgrade_To_Full'>
320
- <button class="bpfwp-dashboard-get-premium-widget-button bpfwp-dashboard-new-trial-button">GET FREE 7-DAY TRIAL</button>
321
- </form>
322
- <?php } ?>
323
- </div>
324
  </div>
325
  <?php } ?>
 
326
 
327
  <!-- <div class="bpfwp-dashboard-new-widget-box ewd-widget-box-full">
328
  <div class="bpfwp-dashboard-new-widget-box-top">Other Plugins by Etoile</div>
@@ -356,15 +276,11 @@ class bpfwpDashboard {
356
  <div class="bpfwp-dashboard-new-footer-one-left">
357
  <div class="bpfwp-dashboard-new-footer-one-title">What's Included in Our Premium Version?</div>
358
  <ul class="bpfwp-dashboard-new-footer-one-benefits">
359
- <li>Multiple Form Layouts</li>
360
- <li>Custom Form Fields</li>
361
- <li>Advanced Email Designer</li>
362
- <li>MailChimp Integration</li>
363
- <li>Set Table and Seat Restrictions</li>
364
- <li>Automatic Booking Confirmation</li>
365
- <li>Bookings Page for Staff</li>
366
- <li>Export Bookings</li>
367
- <li>Advanced Styling Options</li>
368
  </ul>
369
  </div>
370
  <div class="bpfwp-dashboard-new-footer-one-buttons">
14
 
15
  public function __construct() {
16
  add_action( 'admin_menu', array( $this, 'add_dashboard_to_menu' ), 99 );
 
 
 
 
17
 
18
  add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
19
  }
65
  }
66
  }
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  public function display_dashboard_screen() {
69
  global $bpfwp_controller;
70
 
75
 
76
  <div id="bpfwp-dashboard-content-left">
77
 
78
+ <?php if ( ! $permission or get_option("BPFWP_Trial_Happening") == "Yes") {
79
+ $premium_info = '<div class="bpfwp-dashboard-new-widget-box ewd-widget-box-full">';
80
+ $premium_info .= '<div class="bpfwp-dashboard-new-widget-box-top">';
81
+ $premium_info .= sprintf( __( '<a href="%s" target="_blank">Visit our website</a> to learn how to upgrade to premium.'), 'https://www.fivestarplugins.com/premium-upgrade-instructions/' );
82
+ $premium_info .= '</div>';
83
+ $premium_info .= '</div>';
84
+
85
+ echo apply_filters( 'fsp_dashboard_top', $premium_info, 'BPFWP', 'https://www.fivestarplugins.com/license-payment/?Selected=BPFWP&Quantity=1' );
86
+ } ?>
 
 
87
 
88
  <div class="bpfwp-dashboard-new-widget-box ewd-widget-box-full" id="bpfwp-dashboard-support-widget-box">
89
  <div class="bpfwp-dashboard-new-widget-box-top">Get Support<span id="bpfwp-dash-mobile-support-down-caret">&nbsp;&nbsp;&#9660;</span><span id="bpfwp-dash-mobile-support-up-caret">&nbsp;&nbsp;&#9650;</span></div>
216
  </div> <!-- left -->
217
 
218
  <div id="bpfwp-dashboard-content-right">
219
+
220
  <?php if ( ! $permission or get_option("BPFWP_Trial_Happening") == "Yes" ) { ?>
221
+ <div class="bpfwp-dashboard-new-widget-box ewd-widget-box-full" id="bpfwp-dashboard-get-premium-widget-box">
222
  <div class="bpfwp-dashboard-new-widget-box-top">Get Premium</div>
223
+
224
+ <?php if ( get_option("BPFWP_Trial_Happening") == "Yes" ) { do_action( 'fsp_trial_happening', 'BPFWP' ); } ?>
225
+
 
 
 
 
 
 
 
 
 
 
 
 
226
  <div class="bpfwp-dashboard-new-widget-box-bottom">
227
  <div class="bpfwp-dashboard-get-premium-widget-features-title"<?php echo ( get_option("BPFWP_Trial_Happening") == "Yes" ? "style='padding-top: 20px;'" : ""); ?>>GET FULL ACCESS WITH OUR PREMIUM VERSION AND GET:</div>
228
  <ul class="bpfwp-dashboard-get-premium-widget-features">
229
+ <li>WooCommerce Integration</li>
230
+ <li>Google Rich Snippets</li>
231
+ <li>Schema Default Helpers</li>
 
232
  <li>+ More</li>
233
  </ul>
234
  <a href="https://www.fivestarplugins.com/license-payment/?Selected=BPFWP&Quantity=1" class="bpfwp-dashboard-get-premium-widget-button" target="_blank">UPGRADE NOW</a>
235
+
236
+ <?php if ( ! get_option( "BPFWP_Trial_Happening" ) ) {
237
+ $trial_info = sprintf( __( '<a href="%s" target="_blank">Visit our website</a> to learn how to get a free 7-day trial of the premium plugin.'), 'https://www.fivestarplugins.com/premium-upgrade-instructions/' );
238
+
239
+ echo apply_filters( 'fsp_trial_button', $trial_info, 'BPFWP' );
240
+ } ?>
241
+ </div>
242
+
243
  </div>
244
  <?php } ?>
245
+ </div>
246
 
247
  <!-- <div class="bpfwp-dashboard-new-widget-box ewd-widget-box-full">
248
  <div class="bpfwp-dashboard-new-widget-box-top">Other Plugins by Etoile</div>
276
  <div class="bpfwp-dashboard-new-footer-one-left">
277
  <div class="bpfwp-dashboard-new-footer-one-title">What's Included in Our Premium Version?</div>
278
  <ul class="bpfwp-dashboard-new-footer-one-benefits">
279
+ <li>WooCommerce Integration</li>
280
+ <li>Full Product Schema Automatically Applied</li>
281
+ <li>Automatically-integrated schema for posts</li>
282
+ <li>Default Schema Helpers</li>
283
+ <li>Quickly add schema for any page/element using our custom list of defaults</li>
 
 
 
 
284
  </ul>
285
  </div>
286
  <div class="bpfwp-dashboard-new-footer-one-buttons">
includes/class-installation-walkthrough.php CHANGED
@@ -122,6 +122,8 @@ class bpfwpInstallationWalkthrough {
122
  ));
123
 
124
  $bpfwp_controller->settings->set_setting( 'contact-page', $contact_page );
 
 
125
 
126
  exit();
127
  }
@@ -134,6 +136,8 @@ class bpfwpInstallationWalkthrough {
134
  $bpfwp_controller->settings->set_setting( 'address', array( 'text' => sanitize_textarea_field( $_POST['address'] ) ) );
135
  $bpfwp_controller->settings->set_setting( 'phone', sanitize_text_field( $_POST['phone'] ) );
136
  $bpfwp_controller->settings->set_setting( 'contact-email', sanitize_text_field( $_POST['email'] ) );
 
 
137
 
138
  exit();
139
  }
@@ -144,6 +148,8 @@ class bpfwpInstallationWalkthrough {
144
  $sanitized_data = $this->scheduler->sanitize_callback_wrapper( $_POST['walkthrough']['opening-hours'] );
145
 
146
  $bpfwp_controller->settings->set_setting( 'opening-hours', $sanitized_data );
 
 
147
 
148
  exit();
149
  }
122
  ));
123
 
124
  $bpfwp_controller->settings->set_setting( 'contact-page', $contact_page );
125
+
126
+ $bpfwp_controller->settings->save_settings();
127
 
128
  exit();
129
  }
136
  $bpfwp_controller->settings->set_setting( 'address', array( 'text' => sanitize_textarea_field( $_POST['address'] ) ) );
137
  $bpfwp_controller->settings->set_setting( 'phone', sanitize_text_field( $_POST['phone'] ) );
138
  $bpfwp_controller->settings->set_setting( 'contact-email', sanitize_text_field( $_POST['email'] ) );
139
+
140
+ $bpfwp_controller->settings->save_settings();
141
 
142
  exit();
143
  }
148
  $sanitized_data = $this->scheduler->sanitize_callback_wrapper( $_POST['walkthrough']['opening-hours'] );
149
 
150
  $bpfwp_controller->settings->set_setting( 'opening-hours', $sanitized_data );
151
+
152
+ $bpfwp_controller->settings->save_settings();
153
 
154
  exit();
155
  }
includes/class-schema-cpt.php CHANGED
@@ -386,7 +386,7 @@ if ( ! class_exists( 'bpfwpSchemaCPT' ) ) :
386
 
387
  if ( $field->input == 'SchemaField' ) {
388
  foreach ( $field->children as $field_child ) {
389
- if ( $field->repeatable ) { $max_count = $_POST['count_' . $this->schema_type][$field_prefix . $field->slug]; }
390
  else { $max_count = 1; }
391
 
392
  for ( $i = 1; $i <= $max_count; $i++ ) {
@@ -396,7 +396,7 @@ if ( ! class_exists( 'bpfwpSchemaCPT' ) ) :
396
  }
397
  }
398
  else {
399
- $values[$field_prefix . $field->slug][$count] = $_POST[$this->schema_type][$field_prefix . $field->slug][$count];
400
  }
401
 
402
  return $value;
@@ -414,6 +414,7 @@ if ( ! class_exists( 'bpfwpSchemaCPT' ) ) :
414
  global $post;
415
  // @to-do: THIS NEEDS TO BE CHANGED TO WORK WITH NON-POST OBJECTS
416
  $values = get_post_meta( $post->ID, 'bpfwp_values_' . $this->schema_type, true );
 
417
 
418
  $output = array();
419
 
@@ -421,7 +422,7 @@ if ( ! class_exists( 'bpfwpSchemaCPT' ) ) :
421
  $output['@type'] = $this->schema_type;
422
 
423
  foreach ( $this->schema_class->fields as $field ) {
424
- $output[$field->slug] = $this->get_field_output_value($values, $field);
425
  }
426
 
427
  $ld_json[] = $output;
@@ -439,27 +440,35 @@ if ( ! class_exists( 'bpfwpSchemaCPT' ) ) :
439
  * @param int $count Which iteration of this field are we retrieving.
440
  * @return mixed $value;
441
  */
442
- public function get_field_output_value( $values, $field, $count = 1 ) {
443
  global $post;
444
 
 
 
445
  if ( $field->input == 'SchemaField' ) {
446
  //$max_count = sizeOf($values[$field->slug]);
447
  $max_count = 1;
448
 
 
 
449
  for ( $i = 1; $i <= $max_count; $i++ ) {
 
450
  foreach ( $field->children as $field_child ) {
 
451
  //$value[$field_child->slug][$i] = $this->get_field_output_value($values[$field->slug], $field_child, $i);
452
- $values[$field->slug] = isset($values[$field->slug]) ? $values[$field->slug] : array();
453
- $value[$field_child->slug] = $this->get_field_output_value($values[$field->slug], $field_child, $i);
 
 
454
  }
455
  }
456
  }
457
  else {
458
- $user_value = isset($values[$field->slug]) ? $values[$field->slug] : '';
459
 
460
  if ( is_array( $user_value) ) { $user_value = $user_value[$count]; }
461
 
462
- if ( ! $user_value ) { $default_value = $field->get_default_value($post->ID, 'post'); }
463
 
464
  $value = $user_value ? $user_value : ( $default_value ? $default_value : '' );
465
  }
386
 
387
  if ( $field->input == 'SchemaField' ) {
388
  foreach ( $field->children as $field_child ) {
389
+ if ( $field->repeatable ) { $max_count = intval( $_POST['count_' . $this->schema_type][$field_prefix . $field->slug] ); }
390
  else { $max_count = 1; }
391
 
392
  for ( $i = 1; $i <= $max_count; $i++ ) {
396
  }
397
  }
398
  else {
399
+ $values[$field_prefix . $field->slug][$count] = sanitize_text_field( $_POST[$this->schema_type][$field_prefix . $field->slug][$count] );
400
  }
401
 
402
  return $value;
414
  global $post;
415
  // @to-do: THIS NEEDS TO BE CHANGED TO WORK WITH NON-POST OBJECTS
416
  $values = get_post_meta( $post->ID, 'bpfwp_values_' . $this->schema_type, true );
417
+ $values = is_array( $values ) ? $values : array();
418
 
419
  $output = array();
420
 
422
  $output['@type'] = $this->schema_type;
423
 
424
  foreach ( $this->schema_class->fields as $field ) {
425
+ $output[$field->slug] = $this->get_field_output_value($values, $field, 1);
426
  }
427
 
428
  $ld_json[] = $output;
440
  * @param int $count Which iteration of this field are we retrieving.
441
  * @return mixed $value;
442
  */
443
+ public function get_field_output_value( $values, $field, $count = 1, $field_prefix = '' ) {
444
  global $post;
445
 
446
+ $field->callback = ( isset($this->field_defaults[$field_prefix . '_' . $field->slug]) and $this->field_defaults[$field_prefix . '_' . $field->slug] != '' ) ? $this->field_defaults[$field_prefix . '_' . $field->slug] : $field->callback;
447
+
448
  if ( $field->input == 'SchemaField' ) {
449
  //$max_count = sizeOf($values[$field->slug]);
450
  $max_count = 1;
451
 
452
+ $field_prefix .= '_' . $field->slug;
453
+
454
  for ( $i = 1; $i <= $max_count; $i++ ) {
455
+
456
  foreach ( $field->children as $field_child ) {
457
+
458
  //$value[$field_child->slug][$i] = $this->get_field_output_value($values[$field->slug], $field_child, $i);
459
+
460
+ $values[$field->slug] = isset( $values['_' . $field->slug] ) ? $values['_' . $field->slug] : array();
461
+
462
+ $value[$field_child->slug] = $this->get_field_output_value( $values[$field->slug], $field_child, $i, $field_prefix );
463
  }
464
  }
465
  }
466
  else {
467
+ $user_value = isset( $values['_' . $field->slug] ) ? $values['_' . $field->slug] : '';
468
 
469
  if ( is_array( $user_value) ) { $user_value = $user_value[$count]; }
470
 
471
+ if ( ! $user_value ) { $default_value = $field->get_default_value( $post->ID, 'post' ); }
472
 
473
  $value = $user_value ? $user_value : ( $default_value ? $default_value : '' );
474
  }
includes/class-settings.php CHANGED
@@ -200,7 +200,14 @@ if ( ! class_exists( 'bpfwpSettings' ) ) :
200
  if ( $setting_name ) {
201
  $this->settings[ $setting_name ] = $setting_value;
202
  }
 
203
 
 
 
 
 
 
 
204
  update_option( 'bpfwp-settings', $this->settings );
205
  }
206
 
200
  if ( $setting_name ) {
201
  $this->settings[ $setting_name ] = $setting_value;
202
  }
203
+ }
204
 
205
+ /**
206
+ * Save all settings, to be used with set_setting
207
+ * @since 2.0.8
208
+ */
209
+ public function save_settings() {
210
+
211
  update_option( 'bpfwp-settings', $this->settings );
212
  }
213
 
includes/schemas/class-schema-field.php CHANGED
@@ -169,7 +169,6 @@ if ( ! class_exists( 'bpfwpSchemaField' ) ) :
169
  $value = $operation . ' ' . $command;
170
  }
171
 
172
-
173
  return $value;
174
  }
175
  }
169
  $value = $operation . ' ' . $command;
170
  }
171
 
 
172
  return $value;
173
  }
174
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: FiveStarPlugins
3
  Author URI: https://www.fivestarplugins.com/
4
  Plugin URL: https://www.fivestarplugins.com/plugins/business-profile/
5
  Requires at Least: 4.4
6
- Tested Up To: 5.4
7
  Tags: business profile, seo, local seo, schema, address, google map, contact, phone, contact card, vcard, contact info, business location, business address, business map, business schema, organization schema, corporation schema, contact schema, address schema, location schema, map schema, business structured data, business microdata, address microdata, location structured data, location microdata, contact shortcode, location shortcode, address shortcode, schema shortcode, gutenberg schema, gutenberg address
8
  License: GPLv3
9
  License URI:http://www.gnu.org/licenses/gpl-3.0.html
@@ -188,6 +188,13 @@ You'll find more help in the [User Guide](http://doc.themeofthecrop.com/plugins/
188
 
189
  == Changelog ==
190
 
 
 
 
 
 
 
 
191
  = 2.0.7 (2020-06-04) =
192
  - Updating the admin dashboard area
193
 
3
  Author URI: https://www.fivestarplugins.com/
4
  Plugin URL: https://www.fivestarplugins.com/plugins/business-profile/
5
  Requires at Least: 4.4
6
+ Tested Up To: 5.5
7
  Tags: business profile, seo, local seo, schema, address, google map, contact, phone, contact card, vcard, contact info, business location, business address, business map, business schema, organization schema, corporation schema, contact schema, address schema, location schema, map schema, business structured data, business microdata, address microdata, location structured data, location microdata, contact shortcode, location shortcode, address shortcode, schema shortcode, gutenberg schema, gutenberg address
8
  License: GPLv3
9
  License URI:http://www.gnu.org/licenses/gpl-3.0.html
188
 
189
  == Changelog ==
190
 
191
+ = 2.0.8 (2020-08-12) =
192
+ - Fix for the initial walk-through and the chosen contact page not being populated
193
+ - Fix for default values not being applied
194
+ - Correcting/eliminating several PHP notices
195
+ - CSS updates for the admin panel
196
+ - Enhanced upgrade process
197
+
198
  = 2.0.7 (2020-06-04) =
199
  - Updating the admin dashboard area
200