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