# visual-web-optimizer/4.15/VwoTemplater.php

Wingify, version 4.15. 31 lines.

- Page: https://pluginprobe.com/plugins/visual-web-optimizer/4.15/code/VwoTemplater.php
- Raw: https://pluginprobe.com/plugins/visual-web-optimizer/4.15/raw/VwoTemplater.php
- Modified: 2026-09-18T13:47:10+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/visual-web-optimizer/4.15/code/VwoTemplater.php#L10-L20`.

```php
<?php
defined( 'ABSPATH' ) or exit;

class VwoTemplater {
    protected $dirs = [];

    public function __construct( array $dirs = [ '' ] ) {
        $this->dirs = $dirs;
    }

    protected function find( $file ) {
        foreach ( $this->dirs as $dir ) {
            if ( is_file( $path = ( $dir ? trailingslashit( $dir ) : '' ) . $file ) ) return $path;
            elseif ( is_file( $path .= '.php' ) ) return $path;
        }
        return false;
    }

    public function render( string $file, array $vars = [] ) {
        if ( ! $file = $this->find( $file ) ) {
            return false;
        }
        if ( $vars ) extract( $vars, EXTR_SKIP );

        ob_start();
        include $file;

        return ob_get_clean();
    }
}

```
