bkf_compare_semantic_version($standard, $applicant) #
We use this to compare the current version to plugin headers (“BKF tested up to” and “BKF requires at least”).
$standard is the version that should be met, $applicant is the version that needs to meet it. The boolean returned is whether there is an issue (ie. applicant does not meet standard).
This function can read up to 4 levels – eg. 3.0.2.1 – however, cannot interpret any portion containing letters or dashes (eg. 3.0.2-rc1), only numbers and periods.
Usage example:
// Plugin A is running v3.0.2
$current = "3.0.2";
// Plugin B requires at least v3.1.0 of Plugin A
$required = "3.1.0";
return bkf_compare_semantic_version($required, $current);
// The above would return true to indicate there is an issue, because the current version is lower than the required version.
bkf_calc_cost($cost) #
We use this to display flat rate delivery fees as inclusive of tax throughout the backend. Usage example:
$cost_raw = "15 / 1.1";
$cost = bkf_calc_cost($cost_raw);
return $cost;
// Assuming one tax of 10%, this would return 15
bkf_shipping_tax_rates() #
Helper function, returns a nested array of tax rates that are applicable to shipping.
bkf_get_shipping_methods() #
Helper function, returns an array of WC_Shipping_Method
objects.
bkf_get_shipping_zones() #
Helper function, returns a nested array of delivery zones, in the following format:
[
{
'name' => 'WA',
'id' => '1',
'locations' => [
{
"code":"AU:WA",
"type":"state"
},
{
"code":"6000...6999",
"type":"postcode"}
],
'location' => 'Western Australia',
'methods' => [
'method' => [WP_Shipping_Method Object],
'type' => 'floristpress',
'enabled' => true,
'instanceid' => '11',
'settings' => [Array],
'rateid' => floristpress:11,
'usertitle' => 'Delivery - Zone 2',
'tax_status' => true,
'cost' => '15',
'suburbs' => [Array],
'hassuburbs' => false,
'title' => 'FloristPress Suburbs List',
'method_suburbs'=> [Array]
]
}
]
bkf_get_rss_feed($url) #
We use this to retrieve our news feed for the admin dashboard widget. It returns the items in the feed only, as an array of objects.
Usage example:
$url = 'https://www.feedforall.com/sample.xml';
$feed = bkf_get_rss_feed($url);
echo '<ul>';
foreach($feed as $entry){
echo '<li><a href="'.$entry->link.'">'.$entry->title.'</a></li>';
}
echo '</ul>';
bkf_full_count() #
We use this to get the count of all orders for our updated admin orders list filters. It returns the total number of orders as an integer.
Usage example:
$fullcount = bkf_full_count();
echo 'You have received a total of '.$fullcount.' orders.';
bkf_all_count() #
We use this to get the count of active orders for our updated admin orders list filters. It returns the total number of orders as an integer, for the following statuses:
- Received
- Scheduled
- New (Petals)
- Accepted (Petals)
- Prepared
- Ready for Collection
- Out for Delivery
- Draft Phone Order
- Invoiced
Usage example:
$allcount = bkf_all_count();
echo 'You have currently have '.$allcount.' active orders.';