PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.2.0
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.2.0
4.5.4 4.2.1 4.2.2 4.2.3 4.5.0 4.5.2 4.5.3 4.2.0 4.1.18 4.1.17 4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 All 146 releases
ultimate-post-kit / includes / class-elements-wpml-compatibility.php

class-elements-wpml-compatibility.php in Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets 4.2.0, at includes/class-elements-wpml-compatibility.php

201 lines 6.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace UltimatePostKit\Includes;
4
5 /**
6 * UltimatePostKit_WPML class
7 */
8
9 if (! defined('ABSPATH')) {
10 exit; // Exit if accessed directly.
11 }
12
13 class Ultimate_Post_Kit_WPML {
14
15 /**
16 * A reference to an instance of this class.
17 * @since 3.1.0
18 * @var object
19 */
20 private static $instance = null;
21
22 /**
23 * Constructor for the class
24 */
25 public function init() {
26
27 // WPML existence check - register nodes when WPML core or String Translation is present
28 if (defined('WPML_ST_VERSION') || defined('WPML_VERSION') || defined('ICL_SITEPRESS_VERSION') || function_exists('icl_register_string')) {
29 add_filter('wpml_elementor_widgets_to_translate', array($this, 'add_translatable_nodes'));
30 }
31 }
32
33 /**
34 * Load wpml required repeater class files.
35 * @return void
36 */
37 public function load_wpml_modules() {
38
39 require_once( BDTUPK_PATH . 'includes/compatiblity/wpml/wpml-module-with-items.php' );
40
41 require_once( BDTUPK_PATH . 'includes/compatiblity/wpml/class-wpml-upk-static-social-count.php' );
42 require_once( BDTUPK_PATH . 'includes/compatiblity/wpml/class-wpml-upk-social-share.php' );
43
44 require_once( BDTUPK_PATH . 'includes/compatiblity/wpml/class-wpml-upk-pro-social-link.php' );
45 require_once( BDTUPK_PATH . 'includes/compatiblity/wpml/class-wpml-upk-pro-holux-tabs.php' );
46 require_once( BDTUPK_PATH . 'includes/compatiblity/wpml/class-wpml-upk-pro-post-info.php' );
47 }
48
49 /**
50 * Add ultimate post kit translation nodes
51 * @param array $nodes_to_translate
52 * @return array
53 */
54 public function add_translatable_nodes($nodes_to_translate) {
55
56 $this->load_wpml_modules();
57
58 $nodes_to_translate['upk-banner'] = [
59 'conditions' => [
60 'widgetType' => 'upk-banner',
61 ],
62 'fields' => [
63 [
64 'field' => 'title_text',
65 'type' => esc_html__( 'Title Text', 'ultimate-post-kit' ),
66 'editor_type' => 'LINE',
67 ],
68 [
69 'field' => 'sub_title_text',
70 'type' => esc_html__( 'Sub Title Text', 'ultimate-post-kit' ),
71 'editor_type' => 'LINE',
72 ],
73 [
74 'field' => 'description_text',
75 'type' => esc_html__( 'Description Text', 'ultimate-post-kit' ),
76 'editor_type' => 'VISUAL',
77 ],
78 [
79 'field' => 'badge_text',
80 'type' => esc_html__( 'Badge Text', 'ultimate-post-kit' ),
81 'editor_type' => 'LINE',
82 ],
83 [
84 'field' => 'banner_size_text',
85 'type' => esc_html__( 'Banner Size Text', 'ultimate-post-kit' ),
86 'editor_type' => 'LINE',
87 ],
88 [
89 'field' => 'readmore_text',
90 'type' => esc_html__( 'Read More Text', 'ultimate-post-kit' ),
91 'editor_type' => 'LINE',
92 ],
93 'readmore_link' => [
94 'field' => 'url',
95 'type' => esc_html__( 'Read More Link', 'ultimate-post-kit' ),
96 'editor_type' => 'LINK',
97 ],
98 ]
99 ];
100
101 $nodes_to_translate['upk-forbes-tabs'] = [
102 'conditions' => [
103 'widgetType' => 'upk-forbes-tabs',
104 ],
105 'fields' => [
106 [
107 'field' => 'header_title_text',
108 'type' => esc_html__( 'Header Label', 'ultimate-post-kit' ),
109 'editor_type' => 'LINE',
110 ],
111 ]
112 ];
113
114 $nodes_to_translate['upk-remote-arrows'] = [
115 'conditions' => [
116 'widgetType' => 'upk-remote-arrows',
117 ],
118 'fields' => [
119 [
120 'field' => 'next_text',
121 'type' => esc_html__( 'Next Text', 'ultimate-post-kit' ),
122 'editor_type' => 'LINE',
123 ],
124 [
125 'field' => 'prev_text',
126 'type' => esc_html__( 'Prev Text', 'ultimate-post-kit' ),
127 'editor_type' => 'LINE',
128 ],
129 ]
130 ];
131
132 $nodes_to_translate['upk-news-ticker'] = [
133 'conditions' => [
134 'widgetType' => 'upk-news-ticker',
135 ],
136 'fields' => [
137 [
138 'field' => 'news_label',
139 'type' => esc_html__( 'Label', 'ultimate-post-kit' ),
140 'editor_type' => 'LINE',
141 ],
142 ]
143 ];
144
145 $nodes_to_translate['upk-static-social-count'] = [
146 'conditions' => [
147 'widgetType' => 'upk-static-social-count',
148 ],
149 'integration-class' => __NAMESPACE__ . '\\WPML_UPK_Static_Social_Count',
150 'fields' => []
151 ];
152
153 $nodes_to_translate['upk-social-share'] = [
154 'conditions' => [
155 'widgetType' => 'upk-social-share',
156 ],
157 'integration-class' => __NAMESPACE__ . '\\WPML_UPK_Social_Share',
158 'fields' => []
159 ];
160
161 $nodes_to_translate['upk-social-link'] = [
162 'conditions' => [
163 'widgetType' => 'upk-social-link',
164 ],
165 'integration-class' => __NAMESPACE__ . '\\WPML_UPK_Pro_Social_Link',
166 'fields' => []
167 ];
168
169 $nodes_to_translate['upk-holux-tabs'] = [
170 'conditions' => [
171 'widgetType' => 'upk-holux-tabs',
172 ],
173 'integration-class' => __NAMESPACE__ . '\\WPML_UPK_Pro_Holux_Tabs',
174 'fields' => []
175 ];
176
177 $nodes_to_translate['upk-post-info'] = [
178 'conditions' => [
179 'widgetType' => 'upk-post-info',
180 ],
181 'integration-class' => __NAMESPACE__ . '\\WPML_UPK_Pro_Post_Info',
182 'fields' => []
183 ];
184
185 return $nodes_to_translate;
186 }
187
188 /**
189 * Returns the instance.
190 * @since 3.1.0
191 * @return object
192 */
193 public static function get_instance() {
194
195 if (null == self::$instance) {
196 self::$instance = new self;
197 }
198 return self::$instance;
199 }
200 }
201