-
Notifications
You must be signed in to change notification settings - Fork 0
/
jet-engine-do-macros-tag.php
67 lines (48 loc) · 1.76 KB
/
jet-engine-do-macros-tag.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
/**
* Plugin Name: JetEngine - Do macros
* Description: Add dynamic tag that processes entered macros.
* Plugin URI:
* Version: 1.0.2
* Author:
* Author URI:
* Text Domain: jet-engine
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! class_exists( 'Do_Macros_Tag' ) ) {
class Do_Macros_Tag {
private $new_elementor = false;
public function __construct() {
add_action( 'plugins_loaded', array( $this, 'add_hooks' ) );
}
public function add_hooks() {
if ( defined( 'ELEMENTOR_VERSION' ) && version_compare( ELEMENTOR_VERSION, '3.5.0', '>=' ) ) {
$this->new_elementor = true;
add_action( 'elementor/dynamic_tags/register', array( $this, 'register_dynamic_tag' ) );
} else {
add_action( 'elementor/dynamic_tags/register_tags', array( $this, 'register_dynamic_tag' ) );
}
}
public function register_dynamic_tag( $dynamic_tags ) {
if ( ! function_exists( 'jet_engine' ) ) {
return;
}
require_once( __DIR__ . '/dynamic-tags/jet-engine-do-macros-dynamic-tag.php' );
require_once( __DIR__ . '/dynamic-tags/jet-engine-do-macros-dynamic-tag-image.php' );
$dynamic_tags->register_tag( 'Elementor_Dynamic_Tag_Jet_Engine_Do_Macros' );
$dynamic_tags->register_tag( 'Elementor_Dynamic_Tag_Jet_Engine_Do_Macros_Image' );
if ( $this->new_elementor ) {
$dynamic_tags->register( new Elementor_Dynamic_Tag_Jet_Engine_Do_Macros() );
$dynamic_tags->register( new Elementor_Dynamic_Tag_Jet_Engine_Do_Macros_Image() );
} else {
$dynamic_tags->register_tag( 'Elementor_Dynamic_Tag_Jet_Engine_Do_Macros' );
$dynamic_tags->register_tag( 'Elementor_Dynamic_Tag_Jet_Engine_Do_Macros_Image' );
}
}
}
}
if ( class_exists( 'Do_Macros_Tag' ) ) {
new Do_Macros_Tag();
}