Helper.php
73 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Bricks Integration helper functions. |
| 4 | * |
| 5 | * @since 3.0.5 |
| 6 | * @package EverestForms\Addons\BricksBuilder |
| 7 | */ |
| 8 | |
| 9 | namespace EverestForms\Addons\BricksBuilder; |
| 10 | |
| 11 | /** |
| 12 | * bricks Integration helper functions. |
| 13 | * |
| 14 | * @package EverestForms\Addons\BricksBuilder |
| 15 | * |
| 16 | * @since 3.0.5 |
| 17 | */ |
| 18 | class Helper { |
| 19 | |
| 20 | /** |
| 21 | * Return if Bricks is active. |
| 22 | * |
| 23 | * @since 3.0.5 |
| 24 | * |
| 25 | * @return boolean |
| 26 | */ |
| 27 | public static function is_bricks_active() { |
| 28 | $active_theme = wp_get_theme(); |
| 29 | |
| 30 | if ( $active_theme->stylesheet === 'bricks' && $active_theme->template === 'bricks' ) { |
| 31 | return true; |
| 32 | } else { |
| 33 | return false; |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Notice if the bricks is not installed. |
| 39 | * |
| 40 | * @since 3.0.5 |
| 41 | */ |
| 42 | public static function print_admin_notice() { |
| 43 | |
| 44 | add_action( |
| 45 | 'admin_notices', |
| 46 | function() { |
| 47 | printf( |
| 48 | '<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>', |
| 49 | esc_html( 'Everest Forms:' ), |
| 50 | wp_kses_post( 'Bricks Integration addon requires Bricks to be installed and activated.', 'everest-forms' ), |
| 51 | esc_html__( 'Dismiss this notice.', 'everest-forms' ) |
| 52 | ); |
| 53 | } |
| 54 | ); |
| 55 | |
| 56 | return; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Get the form list. |
| 61 | * |
| 62 | * @since 3.0.5 |
| 63 | */ |
| 64 | public static function get_form_list() { |
| 65 | $forms = evf_get_all_forms(); |
| 66 | |
| 67 | if ( empty( $forms ) ) { |
| 68 | return $forms; |
| 69 | } |
| 70 | return $forms; |
| 71 | } |
| 72 | } |
| 73 |