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