| @@ -1,8 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Booktics\Admin; |
| 4 | 4 | |
| 5 | +if ( ! defined( 'ABSPATH' ) ) exit; | |
| 6 | + | |
| 5 | 7 | use Booktics\Contracts\Hookable_Service_Contract; |
| 6 | 8 | use Ens\Core\SDK; |
| 7 | 9 | |
| 8 | 10 | class Notification implements Hookable_Service_Contract { |
| @@ -21,8 +23,9 @@ | ||
| 21 | 23 | array( |
| 22 | 24 | 'plugin_name' => 'Booktics', |
| 23 | 25 | 'plugin_slug' => 'booktics', |
| 24 | 26 | 'general_prefix' => 'bt', |
| 27 | + 'hook_prefix' => 'booktics', | |
| 25 | 28 | 'text_domain' => 'booktics', |
| 26 | 29 | 'admin_script_handler' => 'booktics-dashboard-scripts', |
| 27 | 30 | 'sub_menu_filter_hook' => 'booktics_menu', |
| 28 | 31 | 'sub_menu_details' => |
| @@ -38,8 +41,16 @@ | ||
| 38 | 41 | ->init(); |
| 39 | 42 | |
| 40 | 43 | add_filter( |
| 41 | 44 | 'ens_bt_available_actions', function ( $actions ) { |
| 45 | + // Google Meet link generation is gated behind Pro (the pro plugin is what | |
| 46 | + // adds the enable_google_meet field to the service model), but the tag | |
| 47 | + // itself is registered here in free. Without this, a free user picks the | |
| 48 | + // tag, gets an empty value in the email and reads it as a broken feature. | |
| 49 | + $meet_label = booktics_is_pro_active() | |
| 50 | + ? __( 'Google Meet URL', 'booktics' ) | |
| 51 | + : __( 'Google Meet URL (Pro)', 'booktics' ); | |
| 52 | + | |
| 42 | 53 | $actions = array( |
| 43 | 54 | array( |
| 44 | 55 | 'trigger_label' => __( 'Order Created', 'booktics' ), |
| 45 | 56 | 'trigger_value' => 'order_created', |
| @@ -104,9 +115,9 @@ | ||
| 104 | 115 | 'value' => 'customer_name', |
| 105 | 116 | 'type' => 'string', |
| 106 | 117 | ), |
| 107 | 118 | array( |
| 108 | - 'label' => __( 'Google meet Url', 'booktics' ), | |
| 119 | + 'label' => $meet_label, | |
| 109 | 120 | 'value' => 'google_meet_url', |
| 110 | 121 | 'type' => 'string', |
| 111 | 122 | ), |
| 112 | 123 | array( |
| @@ -182,9 +193,9 @@ | ||
| 182 | 193 | 'value' => 'user_email', |
| 183 | 194 | 'type' => 'string', |
| 184 | 195 | ), |
| 185 | 196 | array( |
| 186 | - 'label' => __( 'Google Meet URL', 'booktics' ), | |
| 197 | + 'label' => $meet_label, | |
| 187 | 198 | 'value' => 'google_meet_url', |
| 188 | 199 | 'type' => 'string', |
| 189 | 200 | ), |
| 190 | 201 | array( |
| @@ -422,13 +433,25 @@ | ||
| 422 | 433 | return $message; |
| 423 | 434 | } |
| 424 | 435 | $template = file_get_contents( $template_path ); |
| 425 | 436 | $default_image = get_template_directory_uri() . '/assets/images/placeholder.jpg'; |
| 437 | + $plugin_name = apply_filters( | |
| 438 | + 'booktics_plugin_name', | |
| 439 | + BOOKTICS_PLUGIN_NAME | |
| 440 | + ); | |
| 441 | + $show_powered_by = apply_filters( 'booktics_show_email_powered_by', true ); | |
| 442 | + | |
| 443 | + // Build powered-by HTML if enabled | |
| 444 | + $powered_by_html = ''; | |
| 445 | + if ( $show_powered_by ) { | |
| 446 | + $powered_by_html = '<p class="bkt-powered-by">Powered by ' . esc_html( $plugin_name ) . '</p>'; | |
| 447 | + } | |
| 426 | 448 | $variables = array( |
| 427 | 449 | '{{MESSAGE}}' => wp_kses_post( $message ), |
| 428 | 450 | '{{COMPANY_NAME}}' => booktics_get_option( 'business_name', get_bloginfo( 'name' ) ), |
| 429 | 451 | '{{COMPANY_LOGO}}' => booktics_get_option( 'business_logo', $default_image ), |
| 430 | 452 | '{{COMPANY_ADDRESS}}' => booktics_get_option( 'business_address', 'California, USA' ), |
| 453 | + '{%powered_by_section%}' => $powered_by_html, | |
| 431 | 454 | ); |
| 432 | 455 | |
| 433 | 456 | return str_replace( array_keys( $variables ), array_values( $variables ), $template ); |
| 434 | 457 | } |