PluginProbe ʕ •ᴥ•ʔ
Grid & Styler For Contact Form 7 And Divi / 1.7.1
Grid & Styler For Contact Form 7 And Divi v1.7.1
trunk 1.0.2 1.1.0 1.2.0 1.2.1 1.2.2 1.3.0 1.4.1 1.4.2 1.5.2 1.6.0 1.6.1 1.7.0 1.7.1 2.1.0 2.1.1
cf7-grid-and-styler-for-divi / includes / classes / Loader.php
cf7-grid-and-styler-for-divi / includes / classes Last commit date
Cf7 1 year ago Divi 1 year ago WP 1 year ago Loader.php 1 year ago
Loader.php
98 lines
1 <?php
2
3 namespace WPT\Cf7Divi;
4
5 use WPTools\Pimple\Container;
6 /**
7 * Container
8 */
9 class Loader extends Container {
10 /**
11 *
12 * @var mixed
13 */
14 public static $instance;
15
16 public function __construct() {
17 parent::__construct();
18 $this['bootstrap'] = function ( $container ) {
19 return new WP\Bootstrap($container);
20 };
21 $this['action'] = function ( $container ) {
22 return new WP\Action($container);
23 };
24 $this['cf7_row_shortcode'] = function ( $container ) {
25 return new WP\Shortcodes\Cf7Row($container);
26 };
27 $this['cf7_one_shortcode'] = function ( $container ) {
28 return new WP\Shortcodes\One($container);
29 };
30 $this['cf7_one_half_shortcode'] = function ( $container ) {
31 return new WP\Shortcodes\OneHalf($container);
32 };
33 $this['cf7_one_third_shortcode'] = function ( $container ) {
34 return new WP\Shortcodes\OneThird($container);
35 };
36 $this['cf7_one_fourth_shortcode'] = function ( $container ) {
37 return new WP\Shortcodes\OneFourth($container);
38 };
39 $this['cf7_two_third_shortcode'] = function ( $container ) {
40 return new WP\Shortcodes\TwoThird($container);
41 };
42 $this['cf7_three_fourth_shortcode'] = function ( $container ) {
43 return new WP\Shortcodes\ThreeFourth($container);
44 };
45 $this['cf7_admin'] = function ( $container ) {
46 return new Cf7\Admin($container);
47 };
48 $this['cf7_post_type'] = function ( $container ) {
49 return new Cf7\PostType($container);
50 };
51 }
52
53 /**
54 * Get container instance.
55 */
56 public static function getInstance() {
57 if ( !self::$instance ) {
58 self::$instance = new Loader();
59 }
60 return self::$instance;
61 }
62
63 /**
64 * Plugin run
65 */
66 public function run() {
67 register_activation_hook( $this['plugin_file'], [$this['bootstrap'], 'register_activation_hook'] );
68 add_action( 'admin_menu', [$this['bootstrap'], 'admin_menu'] );
69 add_action( 'wpt_enqueue_cf7_divi_scripts', [$this['action'], 'enqueue_cf7_divi_module_scripts'], 10 );
70 // enable shortcode processing in contact form builder
71 add_filter( 'wpcf7_form_elements', 'do_shortcode' );
72 //
73 add_shortcode( 'wpcf7_row', [$this['cf7_row_shortcode'], 'render'] );
74 add_shortcode( 'wpcf7_one_half', [$this['cf7_one_half_shortcode'], 'render'] );
75 add_shortcode( 'wpcf7_one', [$this['cf7_one_shortcode'], 'render'] );
76 add_shortcode( 'wpcf7_one_third', [$this['cf7_one_third_shortcode'], 'render'] );
77 add_shortcode( 'wpcf7_one_fourth', [$this['cf7_one_fourth_shortcode'], 'render'] );
78 add_shortcode( 'wpcf7_two_third', [$this['cf7_two_third_shortcode'], 'render'] );
79 add_shortcode( 'wpcf7_three_fourth', [$this['cf7_three_fourth_shortcode'], 'render'] );
80 add_action(
81 'admin_enqueue_scripts',
82 [$this['cf7_admin'], 'admin_enqueue_scripts'],
83 10,
84 1
85 );
86 add_action( 'wpcf7_admin_init', [$this['cf7_admin'], 'wpcf7_admin_init'] );
87 add_action( 'wp_print_styles', function () {
88 wp_dequeue_style( 'wpt-cf7-divi-styles' );
89 } );
90 add_action( 'wp_enqueue_scripts', function () {
91 if ( isset( $_GET['et_fb'] ) and $_GET['et_fb'] == '1' ) {
92 do_action( 'wpt_enqueue_cf7_divi_scripts' );
93 }
94 } );
95 }
96
97 }
98