PluginProbe
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! / 3.0.1
Templately – Elementor & Gutenberg Template Library: 6500+ Free & Pro Ready Templates And Cloud! v3.0.1
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/Builder/Managers/LocationManager.php +0 -93 3.1.103.0.1 View file →
@@ -1,19 +1,13 @@
1 1 <?php
2 2
3 3 namespace Templately\Builder\Managers;
4 4
5 -use EbStyleHandler;
6 -use EssentialBlocks\Modules\StyleHandler;
7 5 use Templately\Builder\PageTemplates;
8 6 use Templately\Builder\Source;
9 7 use Templately\Builder\ThemeBuilder;
10 8 use Templately\Builder\Types\BaseTemplate;
11 9 use Templately\Builder\Types\ThemeTemplate;
12 -use ElementorPro\Modules\ThemeBuilder\Module;
13 -use Elementor\Core\Files\CSS\Post as Post_CSS;
14 -use ElementorPro\Plugin;
15 -use Templately\Builder\TemplateLoader;
16 10
17 11 class LocationManager {
18 12 /**
19 13 * @var array<string, ThemeTemplate>
@@ -42,15 +36,8 @@
42 36 * Priority is 13,
43 37 * Because it should be run after elementor & woocommerce
44 38 */
45 39 add_filter( 'template_include', [ $this, 'template_include' ], 13 );
46 -
47 - /**
48 - * Priority is 7,
49 - * Because it should run before elementor
50 - */
51 - add_action( 'wp_enqueue_scripts', [ $this, 'enqueue_styles' ], 7 );
52 - add_action( 'wp_enqueue_scripts', [$this, 'enqueue_template_assets'], 8 );
53 40 }
54 41
55 42 private function set_locations() {
56 43 $this->locations = [
@@ -280,88 +267,8 @@
280 267 $this->set_is_printed( $location, $template_id );
281 268 }
282 269
283 270 return true;
284 - }
285 -
286 - public function enqueue_styles() {
287 -
288 - if (
289 - $this->get_platform(get_the_ID()) !== 'elementor' ||
290 - (
291 - class_exists('ElementorPro\Modules\ThemeBuilder\Module') &&
292 - Module::is_preview()
293 - )
294 - ) {
295 - return;
296 - }
297 -
298 -
299 -
300 - $locations = $this->get_locations();
301 -
302 - if ( empty( $locations ) ) {
303 - return;
304 - }
305 -
306 - // if ( ! empty( $this->current_page_template ) ) {
307 - // $locations = $this->filter_page_template_locations( $locations );
308 - // }
309 -
310 - if(class_exists('Elementor\Core\Files\CSS\Post')){
311 - $current_post_id = get_the_ID();
312 -
313 - /** @var Post_CSS[] $css_files */
314 - $css_files = [];
315 -
316 - foreach ( $locations as $location => $settings ) {
317 - $templates_for_location = $this->builder::$conditions_manager->get_templates_by_location( $location );
318 -
319 - foreach ( $templates_for_location as $document ) {
320 - $post_id = $document->get_main_id();
321 - // Don't enqueue current post here (let the preview/frontend components to handle it)
322 - if ( $current_post_id !== $post_id ) {
323 - $css_file = new Post_CSS( $post_id );
324 - $css_files[] = $css_file;
325 - }
326 - }
327 - }
328 -
329 - if ( ! empty( $css_files ) ) {
330 - // Enqueue the frontend styles manually also for pages that don't built with Elementor.
331 - // Plugin::elementor()->frontend->enqueue_styles();
332 -
333 - // Enqueue after the frontend styles to override them.
334 - foreach ( $css_files as $css_file ) {
335 - $css_file->enqueue();
336 - }
337 -
338 - if(class_exists('ElementorPro\Plugin')){
339 - /** @var \ElementorPro\Modules\ThemeBuilder\Module $theme_builder */
340 - $theme_builder = Plugin::instance()->modules_manager->get_modules( 'theme-builder' );
341 - $location_manager = $theme_builder->get_locations_manager();
342 - remove_action( 'wp_enqueue_scripts', [ $location_manager, 'enqueue_styles' ] );
343 - }
344 - }
345 - }
346 - }
347 -
348 - public function enqueue_template_assets() {
349 - $using_templately_builder = get_query_var( 'using_templately_template' );
350 - if ( ($using_templately_builder || TemplateLoader::is_header_footer()) && function_exists( 'templately' ) ) {
351 - $template_locations = [ 'header', 'footer', 'archive', 'single' ];
352 - foreach ( $template_locations as $location ) {
353 - $template = templately()->theme_builder::$conditions_manager->get_templates_by_location( $location );
354 - if ( empty( $template ) ) {
355 - continue;
356 - }
357 - $template = array_pop( $template );
358 - if ( $template->platform == 'gutenberg' ) {
359 - $template = is_array( $template ) ? array_pop( $template ) : $template;
360 - do_action("templately_printed_location", $template->get_main_id(), $location, $template);
361 - }
362 - }
363 - }
364 271 }
365 272
366 273 /**
367 274 * @param string $location