PluginProbe
Swatchly – Product Variation Swatches for WooCommerce / trunk
Swatchly – Product Variation Swatches for WooCommerce vtrunk
1.4.16 1.4.15 1.4.14 trunk 1.0.5 1.0.7 1.0.9 1.1.0 1.1.1 1.1.2 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 All 49 releases
swatchly / includes / Helper.php

Helper.php in Swatchly – Product Variation Swatches for WooCommerce trunk, at includes/Helper.php

48 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Swatchly;
3
4 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
5
6 class Helper{
7
8 private static $_instance = null;
9
10 /**
11 * Instance
12 */
13 public static function instance(){
14 if( is_null( self::$_instance ) ){
15 self::$_instance = new self();
16 }
17 return self::$_instance;
18 }
19
20 /**
21 * Constructor
22 */
23 public function __construct(){
24
25 }
26
27 /**
28 * If the request is an AJAX request and the action is elementor, then it's an Elementor preview
29 */
30 public static function doing_ajax_is_elementor_preview(){
31 $server = wp_unslash( $_SERVER );
32
33 $referer = !empty($server['referer']) ? $server['referer'] : '';
34 $request_uri = !empty($server['REQUEST_URI']) ? $server['REQUEST_URI'] : '';
35
36 parse_str($referer, $query_str_arr);
37 parse_str($request_uri, $request_uri_arr);
38
39 if( !empty($query_str_arr['action']) && $query_str_arr['action'] == 'elementor' ||
40 !empty($request_uri_arr['action']) && $request_uri_arr['action'] == 'elementor'
41 ){
42 return true;
43 }
44
45 return false;
46 }
47
48 }