Version Description
(2020-10-16) = - Updating the time format of exceptions to use the format you specified in your WP settings, like with regular opening hours. - Updating the localization of exceptions (i.e. to make the month and day, etc. translatable). - Updating the shortcode to also hide the exceptions if you're making use of the show_opening_hours attribute. - Correcting issue causing duplicate structured data in the new JSON-LD formatting. - Correcting issue causing times >
Download this release
Release Info
Developer | Rustaurius |
Plugin | Business Profile |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 2.1.0 to 2.1.1
- business-profile.php +1 -1
- includes/class-settings.php +1 -2
- includes/template-functions.php +46 -33
- readme.txt +10 -2
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.1.
|
7 |
* Author: Five Star Plugins
|
8 |
* Author URI: https://www.fivestarplugins.com
|
9 |
* License: GPLv3
|
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.1.1
|
7 |
* Author: Five Star Plugins
|
8 |
* Author URI: https://www.fivestarplugins.com
|
9 |
* License: GPLv3
|
includes/class-settings.php
CHANGED
@@ -105,7 +105,6 @@ if ( ! class_exists( 'bpfwpSettings' ) ) :
|
|
105 |
'show_contact' => true,
|
106 |
'show_opening_hours' => true,
|
107 |
'show_opening_hours_brief' => false,
|
108 |
-
'show_exceptions' => true,
|
109 |
'show_map' => true,
|
110 |
'show_image' => false,
|
111 |
)
|
@@ -551,7 +550,7 @@ if ( ! class_exists( 'bpfwpSettings' ) ) :
|
|
551 |
array(
|
552 |
'id' => 'exceptions',
|
553 |
'title' => __( 'Exceptions', 'business-profile' ),
|
554 |
-
'description' => __(
|
555 |
'time_format' => _x( 'h:i A', 'Time format displayed in the opening hours setting panel in your admin area. Must match formatting rules at http://amsul.ca/pickadate.js/time.htm#formats', 'business-profile' ),
|
556 |
'date_format' => _x( 'mmmm d, yyyy', 'Date format displayed in the opening hours setting panel in your admin area. Must match formatting rules at http://amsul.ca/pickadate.js/date.htm#formatting-rules', 'business-profile' ),
|
557 |
'disable_weekdays' => true,
|
105 |
'show_contact' => true,
|
106 |
'show_opening_hours' => true,
|
107 |
'show_opening_hours_brief' => false,
|
|
|
108 |
'show_map' => true,
|
109 |
'show_image' => false,
|
110 |
)
|
550 |
array(
|
551 |
'id' => 'exceptions',
|
552 |
'title' => __( 'Exceptions', 'business-profile' ),
|
553 |
+
'description' => __( '<strong>This feature requires at least version 5.3 of WordPress.</strong> Define special opening hours for holidays, events or other needs. Leave the time empty if you\'re closed all day.', 'business-profile' ),
|
554 |
'time_format' => _x( 'h:i A', 'Time format displayed in the opening hours setting panel in your admin area. Must match formatting rules at http://amsul.ca/pickadate.js/time.htm#formats', 'business-profile' ),
|
555 |
'date_format' => _x( 'mmmm d, yyyy', 'Date format displayed in the opening hours setting panel in your admin area. Must match formatting rules at http://amsul.ca/pickadate.js/date.htm#formatting-rules', 'business-profile' ),
|
556 |
'disable_weekdays' => true,
|
includes/template-functions.php
CHANGED
@@ -533,9 +533,9 @@ if ( ! function_exists( 'bpfwp_get_opening_hours_array' ) ) {
|
|
533 |
$start = '00:00';
|
534 |
} else {
|
535 |
$start = trim( substr( $slot['time']['start'], 0, -2 ) );
|
536 |
-
if ( 'PM' === substr( $slot['time']['start'], -2 )
|
537 |
$split = explode( ':', $start );
|
538 |
-
$split[0] += 12;
|
539 |
$start = join( ':', $split );
|
540 |
}
|
541 |
if ( 'AM' === substr( $slot['time']['start'], -2 ) && '12:00' === $start ) {
|
@@ -549,10 +549,10 @@ if ( ! function_exists( 'bpfwp_get_opening_hours_array' ) ) {
|
|
549 |
$end = trim( substr( $slot['time']['end'], 0, -2 ) );
|
550 |
if ( 'PM' === substr( $slot['time']['end'], -2 ) ) {
|
551 |
$split = explode( ':', $end );
|
552 |
-
$split[0] += 12;
|
553 |
$end = join( ':', $split );
|
554 |
}
|
555 |
-
if ( ! empty( $slot['time']['
|
556 |
$end = '24:00';
|
557 |
}
|
558 |
}
|
@@ -581,18 +581,15 @@ if ( ! function_exists( 'bpwfwp_print_exceptions' ) ) {
|
|
581 |
|
582 |
$exceptions = bpfwp_setting( 'exceptions', $location );
|
583 |
|
584 |
-
if ( empty( $exceptions ) ) {
|
585 |
return '';
|
586 |
}
|
587 |
|
588 |
// Print the metatags with proper schema formatting.
|
589 |
$return_data = bpfwp_get_exceptions_array( $exceptions );
|
590 |
|
591 |
-
if ( ! bpfwp_get_display( 'show_exceptions' ) ) {
|
592 |
-
return;
|
593 |
-
}
|
594 |
-
|
595 |
$date_format = get_option('date_format');
|
|
|
596 |
|
597 |
$data = array(
|
598 |
'special_hours' => array(),
|
@@ -611,20 +608,28 @@ if ( ! function_exists( 'bpwfwp_print_exceptions' ) ) {
|
|
611 |
}
|
612 |
}
|
613 |
|
614 |
-
if ( 0 < count( $data['
|
615 |
-
|
616 |
-
<div class="bp-opening-hours
|
617 |
-
<span class="bp-title"><?php _e( '
|
618 |
-
|
619 |
-
<?php foreach ( $data['
|
620 |
-
|
621 |
-
<?php $date = new DateTime($exception['date']); ?>
|
622 |
|
|
|
|
|
|
|
|
|
|
|
|
|
623 |
<div class="bp-date">
|
624 |
-
<span class="label"><?php echo $date->format(
|
625 |
<span class="bp-times">
|
626 |
<span class="bp-time">
|
627 |
-
<?php
|
|
|
|
|
|
|
|
|
628 |
</span>
|
629 |
</span>
|
630 |
</div>
|
@@ -633,20 +638,22 @@ if ( ! function_exists( 'bpwfwp_print_exceptions' ) ) {
|
|
633 |
</div>
|
634 |
<?php }
|
635 |
|
636 |
-
if ( 0 < count( $data['
|
637 |
-
|
638 |
-
<div class="bp-opening-hours
|
639 |
-
<span class="bp-title"><?php _e( '
|
640 |
-
|
641 |
-
<?php foreach ( $data['special_hours'] as $exception ) { ?>
|
642 |
-
|
643 |
-
<?php $date = new DateTime( $exception['date'] ); ?>
|
644 |
|
|
|
|
|
|
|
|
|
645 |
<div class="bp-date">
|
646 |
-
<span class="label"
|
|
|
|
|
647 |
<span class="bp-times">
|
648 |
<span class="bp-time">
|
649 |
-
<?php
|
650 |
</span>
|
651 |
</span>
|
652 |
</div>
|
@@ -678,7 +685,7 @@ if ( ! function_exists( 'bpfwp_get_exceptions_array' ) ) {
|
|
678 |
// Special opening-hours
|
679 |
// @type: specialOpeningHoursSpecification
|
680 |
$special_hours = array(
|
681 |
-
'type' => '
|
682 |
'validFrom' => $exception['date'],
|
683 |
'validThrough' => $exception['date']
|
684 |
);
|
@@ -691,7 +698,7 @@ if ( ! function_exists( 'bpfwp_get_exceptions_array' ) ) {
|
|
691 |
// without opens it is considered as close - holiday
|
692 |
}
|
693 |
|
694 |
-
$result[] = $special_hours;
|
695 |
}
|
696 |
}
|
697 |
|
@@ -806,9 +813,15 @@ if ( ! function_exists( 'bpfwp_json_ld_contact_print' ) ) {
|
|
806 |
$return_string = '';
|
807 |
|
808 |
if ( is_array( $json_data ) ) {
|
809 |
-
|
|
|
|
|
|
|
|
|
810 |
foreach ( $json_data as $key => $data ) { $return_string .= bpfwp_json_ld_contact_print( $key, $data ); }
|
811 |
-
|
|
|
|
|
812 |
}
|
813 |
elseif ( $json_key == 'openingHours' ) {
|
814 |
$return_string .= '"' . $json_key . '": ' . $json_data . ',';
|
533 |
$start = '00:00';
|
534 |
} else {
|
535 |
$start = trim( substr( $slot['time']['start'], 0, -2 ) );
|
536 |
+
if ( 'PM' === substr( $slot['time']['start'], -2 ) ) {
|
537 |
$split = explode( ':', $start );
|
538 |
+
$split[0] += intval($split[0]) == 12 ? 0 : 12;
|
539 |
$start = join( ':', $split );
|
540 |
}
|
541 |
if ( 'AM' === substr( $slot['time']['start'], -2 ) && '12:00' === $start ) {
|
549 |
$end = trim( substr( $slot['time']['end'], 0, -2 ) );
|
550 |
if ( 'PM' === substr( $slot['time']['end'], -2 ) ) {
|
551 |
$split = explode( ':', $end );
|
552 |
+
$split[0] += intval($split[0]) == 12 ? 0 : 12;
|
553 |
$end = join( ':', $split );
|
554 |
}
|
555 |
+
if ( ! empty( $slot['time']['end'] ) && 'AM' === substr( $slot['time']['end'], -2 ) && '12:00' === $end ) {
|
556 |
$end = '24:00';
|
557 |
}
|
558 |
}
|
581 |
|
582 |
$exceptions = bpfwp_setting( 'exceptions', $location );
|
583 |
|
584 |
+
if ( empty( $exceptions ) || ! bpfwp_get_display( 'show_opening_hours' ) || ! function_exists( 'wp_date' ) ) {
|
585 |
return '';
|
586 |
}
|
587 |
|
588 |
// Print the metatags with proper schema formatting.
|
589 |
$return_data = bpfwp_get_exceptions_array( $exceptions );
|
590 |
|
|
|
|
|
|
|
|
|
591 |
$date_format = get_option('date_format');
|
592 |
+
$time_format = get_option('time_format');
|
593 |
|
594 |
$data = array(
|
595 |
'special_hours' => array(),
|
608 |
}
|
609 |
}
|
610 |
|
611 |
+
if ( 0 < count( $data['special_hours'] ) ) { ?>
|
612 |
+
|
613 |
+
<div class="bp-opening-hours special">
|
614 |
+
<span class="bp-title"><?php _e( 'Special Opening Hours', 'business-profile' ); ?></span>
|
615 |
+
|
616 |
+
<?php foreach ( $data['special_hours'] as $exception ) { ?>
|
|
|
|
|
617 |
|
618 |
+
<?php
|
619 |
+
$date = new DateTime( $exception['date'] );
|
620 |
+
$start = new DateTime( $exception['time']['start'] );
|
621 |
+
$end = new DateTime( $exception['time']['end'] );
|
622 |
+
?>
|
623 |
+
|
624 |
<div class="bp-date">
|
625 |
+
<span class="label"><?php echo wp_date($date_format, $date->format( 'U' )); ?></span>
|
626 |
<span class="bp-times">
|
627 |
<span class="bp-time">
|
628 |
+
<?php
|
629 |
+
echo wp_date($time_format, $start->format( 'U' ))
|
630 |
+
. ' – '
|
631 |
+
. wp_date($time_format, $end->format( 'U' ));
|
632 |
+
?>
|
633 |
</span>
|
634 |
</span>
|
635 |
</div>
|
638 |
</div>
|
639 |
<?php }
|
640 |
|
641 |
+
if ( 0 < count( $data['holiday'] ) ) { ?>
|
642 |
+
|
643 |
+
<div class="bp-opening-hours holiday">
|
644 |
+
<span class="bp-title"><?php _e( 'Holidays', 'business-profile' ); ?></span>
|
|
|
|
|
|
|
|
|
645 |
|
646 |
+
<?php foreach ( $data['holiday'] as $exception ) { ?>
|
647 |
+
|
648 |
+
<?php $date = new DateTime($exception['date']); ?>
|
649 |
+
|
650 |
<div class="bp-date">
|
651 |
+
<span class="label">
|
652 |
+
<?php echo wp_date($date_format, $date->format( 'U' )); ?>
|
653 |
+
</span>
|
654 |
<span class="bp-times">
|
655 |
<span class="bp-time">
|
656 |
+
<?php _e( 'Closed', 'business-profile' ); ?>
|
657 |
</span>
|
658 |
</span>
|
659 |
</div>
|
685 |
// Special opening-hours
|
686 |
// @type: specialOpeningHoursSpecification
|
687 |
$special_hours = array(
|
688 |
+
'type' => 'openingHoursSpecification',
|
689 |
'validFrom' => $exception['date'],
|
690 |
'validThrough' => $exception['date']
|
691 |
);
|
698 |
// without opens it is considered as close - holiday
|
699 |
}
|
700 |
|
701 |
+
$result['specialOpeningHoursSpecification'][] = $special_hours;
|
702 |
}
|
703 |
}
|
704 |
|
813 |
$return_string = '';
|
814 |
|
815 |
if ( is_array( $json_data ) ) {
|
816 |
+
|
817 |
+
if ( $json_key === 'specialOpeningHoursSpecification' ) { $return_string .= '"' . $json_key . '": ['; }
|
818 |
+
elseif ( $json_key and ! is_int( $json_key ) ) { $return_string .= '"' . $json_key . '": {'; }
|
819 |
+
elseif ( is_int( $json_key ) ) { $return_string .= '{'; }
|
820 |
+
|
821 |
foreach ( $json_data as $key => $data ) { $return_string .= bpfwp_json_ld_contact_print( $key, $data ); }
|
822 |
+
|
823 |
+
if ( $json_key === 'specialOpeningHoursSpecification' ) { $return_string = trim( $return_string, ',' ) . '],'; }
|
824 |
+
elseif ( $json_key or is_int( $json_key ) ) { $return_string = trim ( $return_string, ',' ) . '},'; }
|
825 |
}
|
826 |
elseif ( $json_key == 'openingHours' ) {
|
827 |
$return_string .= '"' . $json_key . '": ' . $json_data . ',';
|
readme.txt
CHANGED
@@ -2,9 +2,10 @@
|
|
2 |
Contributors: FiveStarPlugins
|
3 |
Author URI: https://www.fivestarplugins.com/
|
4 |
Plugin URL: https://www.fivestarplugins.com/plugins/business-profile/
|
5 |
-
Requires at Least:
|
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
|
10 |
|
@@ -191,6 +192,13 @@ You'll find more help in the [User Guide](http://doc.themeofthecrop.com/plugins/
|
|
191 |
|
192 |
== Changelog ==
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
= 2.1.0 (2020-10-13) =
|
195 |
- <strong>This is a relatively big update with several new features and corrections, etc., so please take caution and test before updating on a live site (or wait a few days before updating in case some minor corrective updates need to be released).</strong>
|
196 |
- Switched the structured data generated by the contact card to the new JSON-LD format.
|
2 |
Contributors: FiveStarPlugins
|
3 |
Author URI: https://www.fivestarplugins.com/
|
4 |
Plugin URL: https://www.fivestarplugins.com/plugins/business-profile/
|
5 |
+
Requires at Least: 5.3
|
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 |
+
Stable tag: 2.1.1
|
9 |
License: GPLv3
|
10 |
License URI:http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
192 |
|
193 |
== Changelog ==
|
194 |
|
195 |
+
= 2.1.1 (2020-10-16) =
|
196 |
+
- Updating the time format of exceptions to use the format you specified in your WP settings, like with regular opening hours.
|
197 |
+
- Updating the localization of exceptions (i.e. to make the month and day, etc. translatable).
|
198 |
+
- Updating the shortcode to also hide the exceptions if you're making use of the show_opening_hours attribute.
|
199 |
+
- Correcting issue causing duplicate structured data in the new JSON-LD formatting.
|
200 |
+
- Correcting issue causing times >= 12pm to sometimes show incorrectly in the JSON code.
|
201 |
+
|
202 |
= 2.1.0 (2020-10-13) =
|
203 |
- <strong>This is a relatively big update with several new features and corrections, etc., so please take caution and test before updating on a live site (or wait a few days before updating in case some minor corrective updates need to be released).</strong>
|
204 |
- Switched the structured data generated by the contact card to the new JSON-LD format.
|