HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: /var/www/kevin-demo/wp-content/plugins/wpforms-sendinblue/src/Provider/Template.php
<?php

namespace WPFormsSendinblue\Provider;

/**
 * Class Template.
 *
 * @since 1.0.0
 */
class Template {

	/**
	 * Init hooks.
	 *
	 * @since 1.0.0
	 */
	public function init() {

		add_filter( 'wpforms_helpers_templates_include_html_located', [ $this, 'register' ], 10, 2 );
	}

	/**
	 * Register addon location.
	 *
	 * @since 1.0.0
	 *
	 * @param string $located  Template location.
	 * @param string $template Template.
	 *
	 * @return string
	 */
	public function register( $located, $template ) {

		// Checking if `$template` is an absolute path and passed from this plugin.
		if (
			strpos( $template, WPFORMS_SENDINBLUE_PATH ) === 0 &&
			is_readable( $template )
		) {
			return $template;
		}

		return $located;
	}

	/**
	 * Get a template for the Settings page.
	 *
	 * @since 1.0.0
	 *
	 * @param string $template_name Template name.
	 * @param array  $args          List of arguments.
	 *
	 * @return string
	 */
	public function get_settings_template( $template_name, $args = [] ) {

		return wpforms_render(
			WPFORMS_SENDINBLUE_PATH . "templates/settings/$template_name",
			$args,
			! empty( $args )
		);
	}

	/**
	 * Get a template for the Builder.
	 *
	 * @since 1.0.0
	 *
	 * @param string $template_name Template name.
	 * @param array  $args          List of arguments.
	 *
	 * @return string
	 */
	public function get_builder_template( $template_name, $args = [] ) {

		return wpforms_render(
			WPFORMS_SENDINBLUE_PATH . "templates/builder/$template_name",
			$args,
			! empty( $args )
		);
	}
}