PluginProbe
Counters Block – showcase your stats with animated numbers / trunk
Counters Block – showcase your stats with animated numbers vtrunk
2.0.8 2.0.7 trunk 1.0.0 1.0.1 1.0.2 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6
counters-block / counters-block.php

counters-block.php in Counters Block – showcase your stats with animated numbers trunk, at counters-block.php

39 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3
4 if (!class_exists('CTRBPBlock')) {
5 class CTRBPBlock
6 {
7 function __construct()
8 {
9 add_action('enqueue_block_assets', [$this, 'enqueueBlockAssets']);
10 add_action('init', [$this, 'onInit']);
11 }
12
13 function enqueueBlockAssets()
14 {
15 wp_register_style('font-awesome-7', CTRB_DIR_URL . 'public/css/font-awesome.min.css', [], '7.1.0');
16 wp_enqueue_style('font-awesome-7');
17
18 $handle = 'ctrb-inline-premium';
19 wp_register_script($handle, false, [], CTRB_VERSION, true);
20 $data = [
21 'isPremium' => function_exists('ctrbIsPremium') ? ctrbIsPremium() : false,
22 'hasPro' => defined('CTRB_HAS_PRO') ? CTRB_HAS_PRO : false,
23 'version' => defined('CTRB_VERSION') ? CTRB_VERSION : '',
24 'isWcActive' => class_exists('WooCommerce'),
25 'isWcInstalled' => file_exists(WP_PLUGIN_DIR . '/woocommerce/woocommerce.php'),
26 ];
27 $inline = 'window.ctrbPremiumProps = Object.assign(window.ctrbPremiumProps || {}, ' . wp_json_encode($data) . ');';
28 wp_add_inline_script($handle, $inline, 'before');
29 wp_enqueue_script($handle);
30 }
31
32 function onInit()
33 {
34 register_block_type(__DIR__ . '/build');
35 }
36 }
37 new CTRBPBlock();
38 }
39