PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 2.2.13
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v2.2.13
3.7.5 3.7.4 3.7.3 3.7.2 1-final 3.7.1 3.7.0 3.6.8 3.6.7 3.6.6 3.6.5 3.6.4 3.6.3 3.6.2 3.6.1 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.10 All 111 releases
← All changes | includes/Core/Platform/Elementor.php +7 -55 3.6.22.2.13 View file →
@@ -47,9 +47,8 @@
47 47 * @return void
48 48 */
49 49 public function styles() {
50 50 templately()->assets->enqueue( 'templately-elementor-preview', 'css/elementor.css' );
51 - templately()->assets->enqueue( 'templately-tailwind', 'css/tailwind.css', ['templately-elementor-preview'] );
52 51 }
53 52
54 53 /**
55 54 * Assets Enqueueing
@@ -56,10 +55,9 @@
56 55 * @return void
57 56 */
58 57 public function scripts() {
59 58 templately()->assets->enqueue( 'templately-elementor', 'css/elementor.css' );
60 - templately()->assets->enqueue( 'templately-tailwind', 'css/tailwind.css', ['templately-elementor'] );
61 - templately()->assets->enqueue( 'templately-elementor', 'js/elementor.js', [ 'jquery' ], true );
59 + templately()->assets->enqueue( 'templately-elementor', 'js/elementor.js', [ 'jquery' ] );
62 60 templately()->admin->scripts( 'elementor' );
63 61 }
64 62
65 63 /**
@@ -76,9 +74,9 @@
76 74 * Checking the template eligibility for import.
77 75 *
78 76 * @return WP_Error|void
79 77 */
80 - protected function is_eligible( $template, $types = [ 'page', 'section','block' ] ) {
78 + protected function is_eligible( $template, $types = [ 'page', 'section' ] ) {
81 79 if ( ! Helper::is_plugin_active( 'elementor-pro/elementor-pro.php' ) &&
82 80 isset( $template['type'] ) &&
83 81 ! in_array( $template['type'], $types, true )
84 82 ) {
@@ -96,12 +94,8 @@
96 94 }
97 95 }
98 96
99 97 public function get_saved_templates( $params = [] ) {
100 - if ( ! function_exists( 'is_plugin_active' ) ){
101 - require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
102 - }
103 -
104 98 $_page_number = isset( $params['page'] ) ? intval( $params['page'] ) : 1;
105 99
106 100 $args = [
107 101 'post_type' => 'elementor_library',
@@ -134,13 +128,11 @@
134 128 wp_reset_postdata();
135 129 wp_reset_query();
136 130
137 131 return array(
138 - 'current_page' => $templates->query_vars['paged'],
139 - 'total_page' => $templates->max_num_pages,
140 - 'items' => $templateList,
141 - 'has_elementor' => rest_sanitize_boolean( \is_plugin_active( 'elementor/elementor.php' ) ),
142 - 'has_elementor_pro' => rest_sanitize_boolean( \is_plugin_active( 'elementor-pro/elementor-pro.php' ) ),
132 + 'current_page' => $templates->query_vars['paged'],
133 + 'total_page' => $templates->max_num_pages,
134 + 'items' => $templateList,
143 135 );
144 136 }
145 137
146 138 private function get_export_link( $template_id ) {
@@ -242,9 +234,9 @@
242 234 * @since 2.0.0
243 235 *
244 236 * @return array|WP_Error array on success, WP_Error on failure.
245 237 */
246 - public function create_page( $id, $title, $importer = null, $settings = [] ) {
238 + public function create_page( $id, $title, $importer = null ) {
247 239 $template_data = $importer->get_content( $id );
248 240
249 241 if ( is_wp_error( $template_data ) ) {
250 242 return $template_data;
@@ -249,12 +241,8 @@
249 241 if ( is_wp_error( $template_data ) ) {
250 242 return $template_data;
251 243 }
252 244
253 - if ( ! empty( $settings ) && ! empty( $template_data['content'] ) && is_array( $template_data['content'] ) ) {
254 - $template_data['content'] = \Templately\Core\Importer\Utils\ElementorSettingsMerger::merge( $template_data['content'], $settings );
255 - }
256 -
257 245 $importer = new ElementorImporter;
258 246 $template_data = $importer->get_data( $template_data );
259 247
260 248 if ( ! empty( $title ) ) {
@@ -287,9 +275,9 @@
287 275 'visit' => get_permalink( $inserted_ID )
288 276 ];
289 277 }
290 278
291 - public function import_in_library( $id, $importer = null, $settings = [] ) {
279 + public function import_in_library( $id, $importer = null ) {
292 280 $template_data = $importer->get_content( $id, 'elementor', 'remote' );
293 281
294 282 if ( is_wp_error( $template_data ) ) {
295 283 return $template_data;
@@ -294,16 +282,8 @@
294 282 if ( is_wp_error( $template_data ) ) {
295 283 return $template_data;
296 284 }
297 285
298 - if ( ! empty( $settings ) && ! empty( $template_data['content'] ) && is_array( $template_data['content'] ) ) {
299 - $template_data['content'] = \Templately\Core\Importer\Utils\ElementorSettingsMerger::merge( $template_data['content'], $settings );
300 - }
301 -
302 - if(trim($template_data['type']) == 'block'){
303 - $template_data['type'] = 'section';
304 - }
305 -
306 286 $importer = new ElementorImporter;
307 287 $imported_template = $importer->import_in_library( $template_data );
308 288
309 289 if( is_wp_error( $imported_template ) ) {
@@ -342,34 +322,6 @@
342 322 public function insert( $data ) {
343 323 $importer = new ElementorImporter();
344 324
345 325 return $importer->get_data( $data );
346 - }
347 -
348 - /**
349 - * Filter Child Type
350 - *
351 - * @param $child_type
352 - * @param $element_data
353 - * @param $element
354 - *
355 - * @return mixed
356 - */
357 - public static function filter_child_type( $child_type, $element_data, $element ) {
358 - // Fix for Elementor Pro Promotion Widget
359 - if ( is_a( $element, 'Elementor\Modules\Promotions\Widgets\Pro_Widget_Promotion' ) || ( is_object( $element ) && 'pro-promotion' === $element->get_name() ) ) {
360 - $el_types = array_keys( Plugin::$instance->elements_manager->get_element_types() );
361 -
362 - if ( isset( $element_data['elType'] ) && in_array( $element_data['elType'], $el_types, true ) ) {
363 - return Plugin::$instance->elements_manager->get_element_types( $element_data['elType'] );
364 - }
365 -
366 - if ( ! isset( $element_data['widgetType'] ) ) {
367 - return null;
368 - }
369 -
370 - return Plugin::$instance->widgets_manager->get_widget_types( $element_data['widgetType'] );
371 - }
372 -
373 - return $child_type;
374 326 }
375 327 }