# countdown-time/1.3.1/includes/Patterns.php

Countdown Timer Block – build urgency for events and launches, version 1.3.1. 40 lines.

- Page: https://pluginprobe.com/plugins/countdown-time/1.3.1/code/includes/Patterns.php
- Raw: https://pluginprobe.com/plugins/countdown-time/1.3.1/raw/includes/Patterns.php
- Modified: 2025-11-29T04:50:08+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/countdown-time/1.3.1/code/includes/Patterns.php#L10-L20`.

```php
<?php
namespace CTB;

if ( !defined( 'ABSPATH' ) ) { exit; }

class Patterns{
	public function __construct(){
		add_action('init', [$this, 'onPluginsLoaded']);
	}

	function onPluginsLoaded(){
		$patterns = wp_json_file_decode( __DIR__ . '/pattern.json', [ 'associative' => true ] );
		$patterns = ctbIsPremium() ? $patterns : array_filter( $patterns, function( $item ) {
			return !isset($item['pro']) || !$item['pro'];
		} );

		// Register Pattern Category
		if ( function_exists( 'register_block_pattern_category' ) ) {
			register_block_pattern_category( 'ctbPattern', [ 'label' => __( 'Countdown Time', 'countdown-time' ) ] );
		}

		// Register Pattern
		if ( !empty( $patterns ) ) {
			foreach ( $patterns as $pattern ) {
				if ( function_exists( 'register_block_pattern' ) ) {
					register_block_pattern( $pattern['name'], [
						'title'			=> $pattern['title'],
						'content'		=> $pattern['content'],
						'description'	=> $pattern['description'],
						'categories'	=> [ 'ctbPattern' ],
						'keywords'		=> $pattern['keywords'],
						'blockTypes'	=> $pattern['blockTypes'],
						'viewportWidth'	=> 1200
					] );
				}
			}
		}
	}
}
new Patterns();
```
