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 )
);
}
}