admin
6 days ago
emails
4 months ago
fields
6 days ago
functions
6 days ago
providers
10 months ago
templates
4 months ago
class-db.php
1 year ago
class-fields.php
1 year ago
class-form.php
6 days ago
class-install.php
1 year ago
class-process.php
4 months ago
class-providers.php
1 year ago
class-templates.php
2 years ago
class-widget.php
1 year ago
deprecated.php
8 months ago
functions-list.php
3 years ago
functions.php
11 months ago
integrations.php
4 months ago
class-providers.php
87 lines
| 1 | <?php |
| 2 | |
| 3 | // phpcs:disable Generic.Commenting.DocComment.MissingShort |
| 4 | /** @noinspection PhpIllegalPsrClassPathInspection */ |
| 5 | /** @noinspection AutoloadingIssuesInspection */ |
| 6 | // phpcs:enable Generic.Commenting.DocComment.MissingShort |
| 7 | |
| 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | exit; |
| 10 | } |
| 11 | |
| 12 | use WPForms\Integrations\ConstantContact\V3\ConstantContact; |
| 13 | |
| 14 | /** |
| 15 | * Load the providers. |
| 16 | * |
| 17 | * @since 1.3.6 |
| 18 | */ |
| 19 | class WPForms_Providers { |
| 20 | |
| 21 | /** |
| 22 | * Primary class constructor. |
| 23 | * |
| 24 | * @since 1.3.6 |
| 25 | */ |
| 26 | public function __construct() { |
| 27 | |
| 28 | $this->init(); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Load and init the base provider class. |
| 33 | * |
| 34 | * @since 1.3.6 |
| 35 | */ |
| 36 | public function init() { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks |
| 37 | |
| 38 | // Parent class template. |
| 39 | require_once WPFORMS_PLUGIN_DIR . 'includes/providers/class-base.php'; |
| 40 | |
| 41 | // Load default templates on WP init. |
| 42 | add_action( 'wpforms_loaded', [ $this, 'load' ] ); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Load default marketing providers. |
| 47 | * |
| 48 | * @since 1.3.6 |
| 49 | */ |
| 50 | public function load() { |
| 51 | |
| 52 | $providers = []; |
| 53 | |
| 54 | if ( ConstantContact::get_current_version() === 2 ) { |
| 55 | $providers[] = 'constant-contact'; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Allow third-party plugins to load their own providers. |
| 60 | * |
| 61 | * @since 1.7.0 |
| 62 | * |
| 63 | * @param array $providers Array of providers to load. |
| 64 | */ |
| 65 | $providers = (array) apply_filters( 'wpforms_load_providers', $providers ); // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName |
| 66 | |
| 67 | foreach ( $providers as $provider ) { |
| 68 | |
| 69 | $provider = sanitize_file_name( $provider ); |
| 70 | $path = WPFORMS_PLUGIN_DIR . 'includes/providers/class-' . $provider . '.php'; |
| 71 | |
| 72 | if ( file_exists( $path ) ) { |
| 73 | require_once $path; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Allow third-party plugins to load their own providers. |
| 78 | * |
| 79 | * @since 1.7.0 |
| 80 | */ |
| 81 | do_action( "wpforms_load_{$provider}_provider" ); // phpcs:ignore WPForms.PHP.ValidateHooks.InvalidHookName |
| 82 | } |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | new WPForms_Providers(); |
| 87 |