1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
<?php
/** * Pre-configured packaged templates. * * @since 1.0.0 */ class WPForms_Templates {
/** * Primary class constructor. * * @since 1.0.0 */ public function __construct() {
$this->init(); }
/** * Load and init the base form template class. * * @since 1.2.8 */ public function init() {
// Parent class template require_once WPFORMS_PLUGIN_DIR . 'includes/templates/class-base.php';
// Load default templates on WP init add_action( 'init', array( $this, 'load' ) ); }
/** * Load default form templates. * * @since 1.0.0 */ public function load() {
$templates = apply_filters( 'wpforms_load_templates', array( 'blank', 'contact', 'request-quote', 'donation', 'order', 'subscribe', 'suggestion', ) );
foreach ( $templates as $template ) {
$template = sanitize_file_name( $template );
if ( file_exists( WPFORMS_PLUGIN_DIR . 'includes/templates/class-' . $template . '.php' ) ) { require_once WPFORMS_PLUGIN_DIR . 'includes/templates/class-' . $template . '.php'; } elseif ( file_exists( WPFORMS_PLUGIN_DIR . 'pro/includes/templates/class-' . $template . '.php' ) && wpforms()->pro ) { require_once WPFORMS_PLUGIN_DIR . 'pro/includes/templates/class-' . $template . '.php'; } } } }
new WPForms_Templates;
|