# post-snippets/4.2.2/src/PostSnippets/View.php

Post Snippets – Custom WordPress Code Snippets Customizer, version 4.2.2. 32 lines.

- Page: https://pluginprobe.com/plugins/post-snippets/4.2.2/code/src/PostSnippets/View.php
- Raw: https://pluginprobe.com/plugins/post-snippets/4.2.2/raw/src/PostSnippets/View.php
- Modified: 2026-03-12T04:56:18+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/post-snippets/4.2.2/code/src/PostSnippets/View.php#L10-L20`.

```php
<?php
namespace PostSnippets;

if ( ! defined( 'ABSPATH' ) ) exit;

/**
 * View Handling.
 *
 */
class View
{
    /**
     * Render a View.
     *
     * @param  string  $view
     * @param  array   $data
     * @return string
     */
    public static function render($view, $data = null)
    {
        // Handle data
        ($data) ? extract($data) : null;

        ob_start();
        include(plugin_dir_path(__FILE__).'../../views/'.$view.'.php');
        $view = ob_get_contents();
        ob_end_clean();

        return $view;
    }
}

```
