<?php /** * Helper functions to work with Providers API. * * @since 1.8.0 */ /** * Get an array of all the active provider addons. * * @since 1.4.7 * * @return array */ function wpforms_get_providers_available() { return (array) apply_filters( 'wpforms_providers_available', [] ); } /** * Get options for all providers. * * @since 1.4.7 * * @param string $provider Define a single provider to get options for this one only. * * @return array */ function wpforms_get_providers_options( $provider = '' ) { $options = get_option( 'wpforms_providers', [] ); $provider = sanitize_key( $provider ); $data = $options; if ( ! empty( $provider ) ) { $data = $options[ $provider ] ?? []; } return (array) apply_filters( 'wpforms_get_providers_options', $data, $provider ); } /** * Update options for all providers. * * @since 1.4.7 * * @param string $provider Provider slug. * @param array|false $options If false is passed - provider will be removed. Otherwise saved. * @param string $key Optional key to identify which connection to update. If empty - generate a new one. */ function wpforms_update_providers_options( $provider, $options, $key = '' ) { $providers = wpforms_get_providers_options(); $id = ! empty( $key ) ? $key : uniqid(); $provider = sanitize_key( $provider ); if ( $options ) { $providers[ $provider ][ $id ] = (array) $options; } else { unset( $providers[ $provider ] ); } update_option( 'wpforms_providers', $providers ); }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
access.php | File | 9.85 KB | 0644 |
|
checks.php | File | 14.4 KB | 0644 |
|
colors.php | File | 3.97 KB | 0644 |
|
data-presets.php | File | 19.03 KB | 0644 |
|
date-time.php | File | 3.2 KB | 0644 |
|
debug.php | File | 5.23 KB | 0644 |
|
education.php | File | 2.32 KB | 0644 |
|
escape-sanitize.php | File | 13.9 KB | 0644 |
|
filesystem-media.php | File | 6.58 KB | 0644 |
|
form-fields.php | File | 16.51 KB | 0644 |
|
forms.php | File | 12.81 KB | 0644 |
|
list.php | File | 6.88 KB | 0644 |
|
payments.php | File | 21.23 KB | 0644 |
|
plugins.php | File | 1.59 KB | 0644 |
|
privacy.php | File | 2.5 KB | 0644 |
|
providers.php | File | 1.49 KB | 0644 |
|
unused.php | File | 7.76 KB | 0644 |
|
utilities.php | File | 7.96 KB | 0644 |
|