# code-snippets/4.0.0-beta.1/php/flat-files/handlers/html-snippet-handler.php

Code Snippets, version 4.0.0-beta.1. 18 lines.

- Page: https://pluginprobe.com/plugins/code-snippets/4.0.0-beta.1/code/php/flat-files/handlers/html-snippet-handler.php
- Raw: https://pluginprobe.com/plugins/code-snippets/4.0.0-beta.1/raw/php/flat-files/handlers/html-snippet-handler.php
- Modified: 2025-10-16T19:08:06+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/code-snippets/4.0.0-beta.1/code/php/flat-files/handlers/html-snippet-handler.php#L10-L20`.

```php
<?php

namespace Code_Snippets;

class Html_Snippet_Handler implements Snippet_Type_Handler_Interface {
	public function get_file_extension(): string {
		return 'php';
	}

	public function get_dir_name(): string {
		return 'html';
	}

	public function wrap_code( string $code ): string {
		return "<?php\n\nif ( ! defined( 'ABSPATH' ) ) { return; }\n\n?>\n\n" . $code;
	}
}

```
