Helper.php
1 year ago
OxygenBuilder.php
1 year ago
OxygenElement.php
1 year ago
OxygenFormWidget.php
2 months ago
Helper.php
81 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Oxygen Integration helper functions. |
| 4 | * |
| 5 | * @since 3.0.5 |
| 6 | * @package EverestForms\Addons\OxygenBuilder |
| 7 | */ |
| 8 | |
| 9 | namespace EverestForms\Addons\OxygenBuilder; |
| 10 | |
| 11 | /** |
| 12 | * Oxygen Integration helper functions. |
| 13 | * |
| 14 | * @package EverestForms\Addons\OxygenBuilder |
| 15 | * |
| 16 | * @since 3.0.5 |
| 17 | */ |
| 18 | class Helper { |
| 19 | |
| 20 | /** |
| 21 | * Return if Oxygen is active. |
| 22 | * |
| 23 | * @since 3.0.5 |
| 24 | * |
| 25 | * @return boolean |
| 26 | */ |
| 27 | public static function is_oxygen_active() { |
| 28 | return in_array( 'oxygen/functions.php', get_option( 'active_plugins', array() ), true ); |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Check if the current request is for oxygen editor. |
| 33 | * |
| 34 | * @since 3.0.5 |
| 35 | * |
| 36 | * @return boolean |
| 37 | */ |
| 38 | public static function is_oxygen_editor() { |
| 39 | return isset( $_REQUEST['action'] ) && ( in_array( $_REQUEST['action'], array( 'oxygen', 'oxygen_ajax' ), true ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Notice if the oxygen is not installed. |
| 44 | * |
| 45 | * @since 3.0.5 |
| 46 | */ |
| 47 | public static function print_admin_notice() { |
| 48 | |
| 49 | add_action( |
| 50 | 'admin_notices', |
| 51 | function () { |
| 52 | printf( |
| 53 | '<div class="notice notice-warning is-dismissible"><p><strong>%s </strong>%s</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">%s</span></button></div>', |
| 54 | esc_html( 'Everest Forms:' ), |
| 55 | wp_kses_post( 'Oxygen Integration addon requires Oxygen to be installed and activated.', 'everest-forms' ), |
| 56 | esc_html__( 'Dismiss this notice.', 'everest-forms' ) |
| 57 | ); |
| 58 | } |
| 59 | ); |
| 60 | |
| 61 | return; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Get the form list. |
| 66 | * |
| 67 | * @since 3.0.5 |
| 68 | */ |
| 69 | public static function get_form_list() { |
| 70 | $forms = evf_get_all_forms(); |
| 71 | |
| 72 | if ( empty( $forms ) ) { |
| 73 | return $forms; |
| 74 | } |
| 75 | |
| 76 | $forms[0] = esc_html__( 'Select a Form', 'everest-forms' ); |
| 77 | |
| 78 | return $forms; |
| 79 | } |
| 80 | } |
| 81 |