-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.php
50 lines (48 loc) · 1.42 KB
/
main.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace WidgetsTestimonialDT;
if (!defined('ABSPATH')) exit;
class WidgetsTestimonialDTMAin
{
public function __construct()
{
add_action('init', [$this, 'check_for_install']);
add_action('elementor/widgets/widgets_registered', [$this, 'register_widgets']);
add_action( 'elementor/elements/categories_registered', [$this, 'add_elementor_widget_categories'] );
}
private function include_widgets_files()
{
require_once(__DIR__ . '/widgets/widget-testimonial.php');
}
public function register_widgets()
{
$this->include_widgets_files();
\Elementor\Plugin::instance()->widgets_manager->register_widget_type(new Widgets\WidgetsTestimonialDTTestimonial());
}
public function check_for_install()
{
WidgetsTestimonialDTMAin::show_redo_warning();
return;
}
private function show_redo_warning()
{
if (!defined('ELEMENTOR_VERSION')) {
$link = "https://pl.wordpress.org/plugins/elementor/";
$plugin = "Elementor Page Builder";
?>
<div class="notice notice-warning is-dismissible">
<p>Please install <a href="<?php echo esc_attr($link); ?>"><?php echo esc_attr($plugin); ?></a> to use REDO JSComposer
Additional.</p>
</div>
<?php
}
}
public function add_elementor_widget_categories($widgets_manager) {
\Elementor\Plugin::$instance->elements_manager->add_category(
'dt-widgets',
[
'title' => esc_html__( 'DT Widgets', 'widgetstestimonialdt' ),
'icon' => 'fa fa-plug',
]
);
}
}