sellkit
/
includes
/
block-editor
/
blocks
/
smart-coupon
/
inner-blocks
/
smart-coupon-code
/
class.php
class.php in SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster 2.7.0, at includes/block-editor/blocks/smart-coupon/inner-blocks/smart-coupon-code/class.php
| 1 | <?php |
| 2 | namespace Sellkit\Blocks\Inner_Block; |
| 3 | |
| 4 | defined( 'ABSPATH' ) || exit; |
| 5 | |
| 6 | use Sellkit\Blocks\Sellkit_Blocks; |
| 7 | |
| 8 | /** |
| 9 | * Smart Coupon Code class. |
| 10 | * |
| 11 | * @since 2.3.0 |
| 12 | * @package Sellkit\Blocks\Inner_Block |
| 13 | */ |
| 14 | class Smart_Coupon_Code { |
| 15 | /** |
| 16 | * Smart_Coupon_Code constructor. |
| 17 | * |
| 18 | * @since 2.3.0 |
| 19 | */ |
| 20 | public function __construct() { |
| 21 | if ( ! is_admin() ) { |
| 22 | add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_scripts' ] ); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | /** |
| 27 | * Enqueue smart coupon code script. |
| 28 | * |
| 29 | * @since 2.3.0 |
| 30 | */ |
| 31 | public function enqueue_scripts() { |
| 32 | wp_enqueue_script( |
| 33 | 'sellkit-block-smart-coupon-code-script', |
| 34 | sellkit()->plugin_url() . 'assets/dist/blocks/smart-coupon-code.js', |
| 35 | [ 'jquery', 'wp-util' ], |
| 36 | sellkit()->version(), |
| 37 | true |
| 38 | ); |
| 39 | |
| 40 | wp_localize_script('sellkit-block-smart-coupon-code-script', 'sellkit_smart_coupon_code', [ |
| 41 | 'nonce' => wp_create_nonce( 'sellkit_smart_coupon_code' ) |
| 42 | ] ); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Register block meta. |
| 47 | * |
| 48 | * @since 2.3.0 |
| 49 | */ |
| 50 | public function register_block_meta() { |
| 51 | register_block_type_from_metadata( |
| 52 | __DIR__ |
| 53 | ); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Render smart coupon code. |
| 58 | * |
| 59 | * @param string $content Block content. |
| 60 | * @since 2.3.0 |
| 61 | * @return string |
| 62 | */ |
| 63 | public function smart_coupon_code( $content ) { |
| 64 | return $content; |
| 65 | } |
| 66 | } |
| 67 |