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