PluginProbe
Countdown Timer Block – build urgency for events and launches / 1.2.7
Countdown Timer Block – build urgency for events and launches v1.2.7
1.3.3 trunk 1.0.0 1.0.1 1.0.2 1.0.3 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 1.1.5 1.1.6 1.1.7 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 All 32 releases
countdown-time / includes / pattern.php

pattern.php in Countdown Timer Block – build urgency for events and launches 1.2.7, at includes/pattern.php

36 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 class CTBPattern{
3 public function __construct(){
4 add_action('plugins_loaded', [$this, 'onPluginsLoaded']);
5 }
6
7 function onPluginsLoaded(){
8 $patterns = wp_json_file_decode( __DIR__ . '/pattern.json', [ 'associative' => true ] );
9 $patterns = ctbIsPremium() ? $patterns : array_filter( $patterns, function( $item ) {
10 return !isset($item['pro']) || !$item['pro'];
11 } );
12
13 // Register Pattern Category
14 if ( function_exists( 'register_block_pattern_category' ) ) {
15 register_block_pattern_category( 'ctbPattern', [ 'label' => __( 'Countdown Time', 'countdown-time' ) ] );
16 }
17
18 // Register Pattern
19 if ( !empty( $patterns ) ) {
20 foreach ( $patterns as $pattern ) {
21 if ( function_exists( 'register_block_pattern' ) ) {
22 register_block_pattern( $pattern['name'], [
23 'title' => $pattern['title'],
24 'content' => $pattern['content'],
25 'description' => $pattern['description'],
26 'categories' => [ 'ctbPattern' ],
27 'keywords' => $pattern['keywords'],
28 'blockTypes' => $pattern['blockTypes'],
29 'viewportWidth' => 1200
30 ] );
31 }
32 }
33 }
34 }
35 }
36 new CTBPattern();