--- a/cost-calculator-builder/cost-calculator-builder.php
+++ b/cost-calculator-builder/cost-calculator-builder.php
@@ -8,7 +8,7 @@
* License: GNU General Public License v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
* Text Domain: cost-calculator-builder
- * Version: 3.6.9
+ * Version: 3.6.10
*/
if ( ! defined( 'ABSPATH' ) ) {
@@ -17,9 +17,9 @@
define( 'CALC_DIR', __DIR__ );
define( 'CALC_FILE', __FILE__ );
-define( 'CALC_VERSION', '3.6.9' );
+define( 'CALC_VERSION', '3.6.10' );
define( 'CALC_WP_TESTED_UP', '6.9' );
-define( 'CALC_DB_VERSION', '3.6.9' );
+define( 'CALC_DB_VERSION', '3.6.10' );
define( 'CALC_PATH', dirname( CALC_FILE ) );
define( 'CALC_URL', plugins_url( '', CALC_FILE ) );
--- a/cost-calculator-builder/includes/classes/CCBFrontController.php
+++ b/cost-calculator-builder/includes/classes/CCBFrontController.php
@@ -45,11 +45,12 @@
return '';
}
- $calculators = CCBUpdatesCallbacks::get_calculators();
- $sticky_calc = '';
- $has_sticky = false;
- $calc_sticky = '';
- $sticky_banner = '';
+ $calculators = CCBUpdatesCallbacks::get_calculators();
+ $sticky_calc = '';
+ $has_sticky = false;
+ $calc_sticky = '';
+ $sticky_banner = '';
+ $has_embed_calc = false;
$positions = array(
'top_left' => 0,
@@ -89,7 +90,6 @@
}
wp_enqueue_style( 'ccb-sticky-css', CALC_URL . '/frontend/dist/css/sticky.css', array(), CALC_VERSION );
- wp_enqueue_style( 'ccb-bootstrap-css', CALC_URL . '/frontend/dist/css/modal.bootstrap.css', array(), CALC_VERSION );
wp_enqueue_script( 'ccb-velocity-ui-js', CALC_URL . '/frontend/dist/libs/velocity.ui.min.js', array(), CALC_VERSION, true );
wp_enqueue_script( 'ccb-velocity-ui-js', CALC_URL . '/frontend/dist/libs/velocity.ui.min.js', array(), CALC_VERSION, true );
@@ -106,6 +106,23 @@
$currency = $global_settings['currency']['use_in_all'] ? $global_settings['currency'] : $calc_settings['currency'];
+ if ( isset( $post->post_content ) && has_shortcode( $post->post_content, 'stm-calc' ) ) {
+ preg_match_all(
+ '/[stm-calcs+id="(d+)"]/',
+ $post->post_content,
+ $matches
+ );
+
+ if ( ! empty( $matches[1] ) ) {
+ foreach ( $matches[1] as $shortcode_id ) {
+ if ( (int) $shortcode_id === (int) $calculator->ID ) {
+ $has_embed_calc = true;
+ break;
+ }
+ }
+ }
+ }
+
$sticky_settings_data = array(
'title' => get_post_meta( $calculator->ID, 'stm-name', true ),
'calcId' => $calculator->ID,
@@ -114,6 +131,7 @@
'currency' => $currency,
'translations' => CCBTranslations::get_frontend_translations(),
'is_pro_active' => ccb_pro_active(),
+ 'has_embed_calc' => $has_embed_calc,
);
$GLOBALS['ccb_sticky_data'][ $calculator->ID ] = $sticky_settings_data;
--- a/cost-calculator-builder/includes/classes/CCBOrderController.php
+++ b/cost-calculator-builder/includes/classes/CCBOrderController.php
@@ -421,80 +421,6 @@
wp_send_json( $result );
}
- public static function complete() {
- check_ajax_referer( 'ccb_complete_payment', 'nonce' );
-
- $result = array(
- 'status' => 'error',
- 'success' => false,
- 'message' => __( 'Invalid data', 'cost-calculator-builder' ),
- );
-
- if ( empty( $_POST['data'] ) ) {
- wp_send_json( $result );
- }
-
- $data = null;
- if ( isset( $_POST['data'] ) ) {
- $data = ccb_convert_from_btoa( $_POST['data'], true );
- }
-
- $order_id = ! empty( $data['orderId'] ) ? sanitize_text_field( $data['orderId'] ) : null;
- if ( ! empty( $order_id ) ) {
- if ( ! is_numeric( $order_id ) ) {
- $result['message'] = __( 'Invalid order id', 'cost-calculator-builder' );
- wp_send_json( $result );
- }
-
- $order = CalcOrders::get_order_full_data_by_id( $order_id );
- if ( empty( $order ) ) {
- $result['message'] = __( 'Order not found', 'cost-calculator-builder' );
- wp_send_json( $result );
- }
-
- try {
- $completed_status = OrdersStatuses::get_completed_status();
- if ( $completed_status['id'] === $order['payment_status'] ) {
- wp_send_json(
- array(
- 'status' => 'error',
- 'success' => false,
- 'message' => __( 'Order already completed', 'cost-calculator-builder' ),
- )
- );
- }
-
- if ( $completed_status['id'] !== $order['payment_status'] ) {
- OrdersPayments::update_payment_status_by_order_id( $order_id, $completed_status['id'] );
- }
-
- wp_send_json(
- array(
- 'status' => 200,
- 'success' => true,
- 'message' => __( 'Order completed successfully', 'cost-calculator-builder' ),
- )
- );
- } catch ( Exception $e ) {
- wp_send_json(
- array(
- 'status' => 'error',
- 'success' => false,
- 'message' => $e->getMessage(),
- )
- );
- }
- }
-
- wp_send_json(
- array(
- 'status' => 'error',
- 'success' => false,
- 'message' => __( 'Invalid order id', 'cost-calculator-builder' ),
- )
- );
- }
-
public static function delete() {}
public static function renderWooCommercePayment() {
--- a/cost-calculator-builder/includes/classes/models/CalcOrders.php
+++ b/cost-calculator-builder/includes/classes/models/CalcOrders.php
@@ -1212,6 +1212,10 @@
$result[] = $calc_settings['formFields']['adminEmailAddress'];
}
- return array_merge( $result, $calc_settings['formFields']['customEmailAddresses'] );
+ if ( ! empty( $calc_settings['formFields']['customEmailAddresses'] ) ) {
+ $result = array_merge( $result, $calc_settings['formFields']['customEmailAddresses'] );
+ }
+
+ return $result;
}
}
--- a/cost-calculator-builder/includes/install.php
+++ b/cost-calculator-builder/includes/install.php
@@ -6,7 +6,6 @@
'ccb_woo_checkout' => wp_create_nonce( 'ccb_woo_checkout' ),
'ccb_add_order' => wp_create_nonce( 'ccb_add_order' ),
'ccb_orders' => wp_create_nonce( 'ccb_orders' ),
- 'ccb_complete_payment' => wp_create_nonce( 'ccb_complete_payment' ),
'ccb_send_invoice' => wp_create_nonce( 'ccb_send_invoice' ),
'ccb_get_invoice' => wp_create_nonce( 'ccb_get_invoice' ),
'ccb_wp_hook_nonce' => wp_create_nonce( 'ccb_wp_hook_nonce' ),